Format Units of Measure - Smart API Connector for Power BI - Help - Hexagon

Smart API Connector for Power BI Help

Language
English
Product
Smart API Connector for Power BI
Search by Category
Help

Entities exposed by a Smart API often contain properties representing a Unit of Measure (UoM). UoM properties are easy to recognize, as their names always end in SiValue. For example, a UoM property that represents the length of a pipe is named PipeLengthSiValue. The value for UoM properties is always stored in SI Units.

The connector provides a special Units of Measure function that converts UoM properties from one unit to a different unit.

The following steps provide an overview:

  1. After you connect to a Smart API, the Navigator dialog shows all available OData entity sets, available functions, and so on.

  2. Select the Apply Units of Measure function and Units of Measure Reference Data in the Navigator dialog box, in addition to any entity set(s) containing UoM properties you wish to use.

    SHARED Tip Certain Smart APIs use the multi-tenant pattern that exposes a single entity set at the service root, for example, Sites. In this case, you must navigate to the desired entity set after selecting and loading the single entity set.

  3. Click Transform Data from the bottom of the Navigator dialog box to open the Power Query Editor.

  4. Select the desired entity set from Queries. If necessary, navigate through to a table for an entity set containing UoM properties.

    You must know which entity set(s) contain UoM properties. See the specific Smart API $metadata document or API documentation for details.

    The sample Smart API shown exposes Sites/Plants/Pipes (that is, Pipes is a navigation property from Plants). From Sites, click Table under the Plants column header to navigate to plants, and then click Table under the Pipes column header for pipes.

  5. Once you select or navigate to the table for an entity with UoM properties, click the Add Column tab and click Invoke Custom Function.

  6. In the Invoke Custom Function dialog box, override the default New column name (if desired), for Function query, select Apply Units of Measure, and for unitsOfMeasureTarget, select the UoM property, for example, LengthSiValue.

  7. Type the desired unitCategory, fromUnit, and toUnit values. The following configuration shows a conversion from meters to feet, precise to two decimal places.

    You must know the unit category for the selected UoM property. Review the Units of Measure Reference Data provided with the connector for possible values. See the specific Smart API $metadata document or API documentation for details.

  8. Click OK to run the conversion. The new column is added to the end of the table with converted values in the toUnit.