Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have 2 columns, one is the product_id & the other is the GM%,
I need to create the below calculated column or a measure with the below formaula:
If(GM%<10,"0",
IF(GM%<20,"Divide(GM%,2)",
"10"
))
But the output of (if) is text, i couldn't make a calculation.
How could you help me?
Regards
Solved! Go to Solution.
Hello @Maahmohammed ,
Please try the below measure I have used Switch instead of "IF" which is more readable.
AdjustedGMMeasure =
SWITCH(TRUE(),
SUM(Table[GM]) < 10, 0,
SUM(Table[GM]) < 20, DIVIDE(SUM(Table[GM]), 2),10)
If you find this helpful , please mark it as solution which will be helpful for others and Your Kudos/Likes are much appreciated!
Thank You
Dharmendar S
Make sure that the data format of the "GM%" column is a numeric type.
In my simple test, the measure works.
Also, the SWITCH function suggested in dharmendars007's reply is a valid solution.
AdjustedGM% = IF(SELECTEDVALUE('Table'[GM%]) < 10, 0, IF(SELECTEDVALUE('Table'[GM%]) < 20, DIVIDE(SELECTEDVALUE('Table'[GM%]), 2), 10))
Best Regards,
Jarvis Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Just a friendly follow up on the case, may I know if these replies have helped you resolve the issue? If they have, please consider accepting helpful reply as a solution.
Best Regards,
Jarvis Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello @Maahmohammed ,
Please try the below measure I have used Switch instead of "IF" which is more readable.
AdjustedGMMeasure =
SWITCH(TRUE(),
SUM(Table[GM]) < 10, 0,
SUM(Table[GM]) < 20, DIVIDE(SUM(Table[GM]), 2),10)
If you find this helpful , please mark it as solution which will be helpful for others and Your Kudos/Likes are much appreciated!
Thank You
Dharmendar S
User | Count |
---|---|
70 | |
70 | |
34 | |
23 | |
22 |
User | Count |
---|---|
96 | |
94 | |
50 | |
42 | |
40 |