Forum Discussion
raima7
10 years agoNew Member
Function convert in Power BI
Hello everybody, :) I'm trying to assign my datas to a unit of measure (kgs, lbs, tons) and I would like to convert them. Someone would have any idea? Thanks
- 10 years ago
Supposing there're trans and rates tables as below
Create a measure as
Total Mass = IF ( ISFILTERED ( Rate[TO_UNIT] ) && HASONEVALUE ( Rate[TO_UNIT] ), SUMX ( Trans, Trans[AMOUNT] * LASTNONBLANK ( Rate[RATE], "" ) ) & " " & LASTNONBLANK ( Rate[TO_UNIT], "" ) & "s", SUMX ( Trans, Trans[AMOUNT] * LASTNONBLANK ( 'Default Rate'[RATE], "" ) ) & " " & LASTNONBLANK ( 'Default Rate'[TO_UNIT], "" ) & "s" )Then use a Slicer to determine the converting UNIT. By default, it shows as kgs.
Choose lbs
Choose tons
Check more details in the attached pbix. If it answers your question, please accept it as solution. For any question, feel free to let me know. :)
ankitpatira
Community Champion
10 years agoraima7 I think you have to make use of meaures or calculated columns in power bi desktop and usign formula in DAX conver them. For example for converting from Kilograms to Pounds you can create calculated column with DAX formula as,
[YourKilogramColumn] * 2.2 = [CalculatedColumnInPounds]