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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
SBC
Helper III
Helper III

Need to Calculate conversion quantity in Power BI

Hi Folks,

I have a requirement to convert all measurementquantityamount  of MT,M3,USG to BBL,

we need to  show all MT,M3,USG  quantityamount  in BBL quantityamount.

Example:

1 BBL = 0.1183432 MT,

1 BBL= 0.159 M3,

1BBL = 42 USG

Below is the Screeenshot of source in different formats MT,M3,USG and BBL need to convert to  all to BBL measuremtnquantityamount .

SBC_2-1662015251928.png

We need to show all M3,MT,USG  in BBL quantityamount, Need solution in  DAX  or method to achieve this.

 

 

 

Thanks,

SBC

 

 

 

 

 

 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @SBC 
Another way is to have a "Conversion" table linked with your table

Measuring Unit Converion Factor
MT 0.1183432
M3 0.159
USG 42
BBL  1

Then you can link Converion[Measuring Unit] with TableName[MsrmntQtyUom] (One - Many single way realtionship)

Then use 
BBLMsrmntQtyAmt = TableName[MsrmntQtyAmt] * RELATED ( Converion[Converion Factor] )

View solution in original post

4 REPLIES 4
tamerj1
Super User
Super User

Hi @SBC 
Another way is to have a "Conversion" table linked with your table

Measuring Unit Converion Factor
MT 0.1183432
M3 0.159
USG 42
BBL  1

Then you can link Converion[Measuring Unit] with TableName[MsrmntQtyUom] (One - Many single way realtionship)

Then use 
BBLMsrmntQtyAmt = TableName[MsrmntQtyAmt] * RELATED ( Converion[Converion Factor] )

Hi @tamerj1 ,

I have tried this method ,works fine for MT,M3 and USG,But for BBL it is showing blank values instead of displaying the  associated values .as below screenshot.

 

 

SBC_0-1662022761464.png

 

Thanks,

SBC

 

@SBC 

Check the spelling. Could be spaces

Fowmy
Super User
Super User

@SBC 

You can add a calculated column as follows:

 

Conversion  = 
 VAR __FACTOR = SWITCH ( 'table'[MsrmntQtyUom], "MT", 0.1183432, "M3" = 0.159, "USG" = 42, "BBL", 1 )
    VAR __RESULT = DIVIDE('table'[MsrmntQtyAmnt], __FACTOR )
    RETURN
        __RESULT

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Top Kudoed Authors