Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
donquijote
Advocate IV
Advocate IV

Direct Query, simple unit conversion scenario

I have a very simple unit conversion problem that I haven't been able to solve in a Direct Query dashboard.

 

Table 1: Has 2 columns, date and value.

 

I would like to be able to display the value column in different units, selected by the user (for example via slicer?)

 

I created Table 2 with two columns: UnitName and ConversionFactor

 

The value I want to be able to display in my visuals is Table1[value] * Table2[ConversionFactor]

 

However given there is no relationship between the tables i cannot use RELATED to do this calculation and so far I haven't found an alternative.

 

Open to other ways to achieve this result in DirectQuery.

 

Thanks

1 ACCEPTED SOLUTION
donquijote
Advocate IV
Advocate IV

This can be solved using a simple calculated measure:

MyMeasure = AVERAGE(Table1[Value]) * AVERAGE([Table2[ConversionFactor]])

When user selects the Table2[UnitName] in the slicer, the visualization of MyMeasure against Table1[Date] updates the converted value correctly in Direct Query.

View solution in original post

1 REPLY 1
donquijote
Advocate IV
Advocate IV

This can be solved using a simple calculated measure:

MyMeasure = AVERAGE(Table1[Value]) * AVERAGE([Table2[ConversionFactor]])

When user selects the Table2[UnitName] in the slicer, the visualization of MyMeasure against Table1[Date] updates the converted value correctly in Direct Query.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.