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
Heather0135
New Member

Calculating a standard Unit of Measure column

Hello,

I have a dataset that has several columns. Two of these columns are related to quantity and the unit of measure that the quantity is in. For example, one row of data may have a quantity in gallons while another row has it in liters. How would I go about creating 1 column that has all of the quanity in gallons? I know in Excel I would just do a vlookup of the original unit of measure in a table that has the unit of measure and the conversion factor to get it to the standard unit of measure that I want, and then multiply this by the quantity. Seems I am not as savvy in PBI as I am in Excel. Much thanks in advance!

1 ACCEPTED SOLUTION
Heather0135
New Member

I think I managed to do this by adding a conditional column with hardcoded conversion factors and then another column that does the multiplication of the quantity and conversion factor. Open to hearing if there are any more efficient/effective solutions.

View solution in original post

2 REPLIES 2
v-yalanwu-msft
Community Support
Community Support

Hi, @Heather0135 ;

You could create a custom column in power query or create a  dax coulmn as follows:

1.create a custom column in power query.

if [unit] ="liters" then [quantity]*0.264172 else [quantity]

vyalanwumsft_0-1626678664316.png

2. create a dax coulmn.

quantity3 = IF([unit]="liters",[quantity]*0.264172,[quantity])

vyalanwumsft_1-1626678722373.png

If my understanding is incorrect, please correct me and share a screenshot of the result you want to output.

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Heather0135
New Member

I think I managed to do this by adding a conditional column with hardcoded conversion factors and then another column that does the multiplication of the quantity and conversion factor. Open to hearing if there are any more efficient/effective solutions.

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.