Forum Discussion
Anonymous
4 years agoNot applicable
DAX measure for Unit Conversion
Please I need help. I have a field named Size and example of information in it is (e.g 30 GB, 50 MB, 40 TB). My goal is to create another column with DAX by converting all the values into GB. So if...
- Anonymous4 years ago
Hi Anonymous ,
Here are the steps you can follow:
1. Create calculated column.
DAX measure for Unit Conversion1 = SWITCH( TRUE(), RIGHT('Table'[Size],2)="GB",VALUE( LEFT('Table'[Size],LEN([Size])-(SEARCH("GB",[Size])-1))), RIGHT('Table'[Size],2)="MB",DIVIDE( VALUE( LEFT('Table'[Size],LEN([Size])-(SEARCH("MB",[Size])-1))),1000), RIGHT('Table'[Size],2)="TB",VALUE( LEFT('Table'[Size],LEN([Size]) -(SEARCH("TB",[Size])-1)))/0.001)2. Select [DAX measure for Unit Conversion1] – set the decimal point to 2.
3. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Anonymous
4 years agoNot applicable
Hi Anonymous ,
Here are the steps you can follow:
1. Create calculated column.
DAX measure for Unit Conversion1 =
SWITCH(
TRUE(),
RIGHT('Table'[Size],2)="GB",VALUE( LEFT('Table'[Size],LEN([Size])-(SEARCH("GB",[Size])-1))),
RIGHT('Table'[Size],2)="MB",DIVIDE( VALUE( LEFT('Table'[Size],LEN([Size])-(SEARCH("MB",[Size])-1))),1000),
RIGHT('Table'[Size],2)="TB",VALUE( LEFT('Table'[Size],LEN([Size]) -(SEARCH("TB",[Size])-1)))/0.001)
2. Select [DAX measure for Unit Conversion1] – set the decimal point to 2.
3. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly