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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Saxon10
Post Prodigy
Post Prodigy

Convert units

 

Hi,

 

Column A:C are length, width and Height and column D is unit of dimension of each rows, column D contain multiple unit of dimension which is CM, MM and M.

 

How can I convert CM and MM into M based on the unit of dimesion column D? In Excel I am apply the convert function but the same function in BI completly is difference. 

 

I would like to achieve my desired result by using new calculate column.

 

Can you please advise. 

 

Rules:

 

1.If column D is CM and MM then convert as Meter (M) from E:G

 

2.If column D is M then return as same from E:G

 

3.If column D is Blank and Length, Width and Height is 0 then return the same thing from E:G

 

DataResult in Meter (M)
LengthWidthHeightUOM DimensionLength in MWidth in MHeight in M
102030CM0.10.20.3
657146CM0.650.710.46
100200300MM123
550110870MM5.51.18.7
12814.5M12814.5
184.818.5M184.818.5
000 000
000 000
000 000

 

Capture1.PNG

 

 

 

 

1 ACCEPTED SOLUTION
selimovd
Most Valuable Professional
Most Valuable Professional

Hey @Saxon10 ,

 

for each of the 3 columns (Lenght, Width and Height) add a calculated column:

Length in Meter =
SWITCH(
    MyTable[UOM Dimension],
    "M", MyTable[Length],
    "CM", MyTable[Length] / 100,
    "MM", MyTable[Length] / 1000
)

 

Same formula for the other 2 measures 😉 

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

View solution in original post

6 REPLIES 6
selimovd
Most Valuable Professional
Most Valuable Professional

Hey @Saxon10 ,

 

for each of the 3 columns (Lenght, Width and Height) add a calculated column:

Length in Meter =
SWITCH(
    MyTable[UOM Dimension],
    "M", MyTable[Length],
    "CM", MyTable[Length] / 100,
    "MM", MyTable[Length] / 1000
)

 

Same formula for the other 2 measures 😉 

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

Thanks for your qucik reply. I am receving error here Exprssions that yield variant data-type cannot be used to define calulated column. 

 

Those three columns came from as a calculate column and those three column are stored as a text so can you please help me.

 

selimovd
Most Valuable Professional
Most Valuable Professional

Hey @Saxon10 ,

 

can you check if the [Length] column is from the format decimal number?

Is the column [UOM Dimension] from the format Text?

 

Can you post a screenshot?

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

Hi,

 

Thanks for your reply. Yes, you are right the length column is not number format that's the reason I got error. If I convert into number then everything is fine. 

Hi @Saxon10,

 

Try to create measures and apply @selimovd's formula.

 

Best Regards,

Link

Thanks for the your reply. Now the problem is fixed and approved the solution 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.