Forum Discussion
How to write the multiple IF statement in PowerBI
Hi there,
May I know how to write below multiple IFs statement in my PowerBI query :-
IF Actual Cost > 90% of the budget , then "Issue"
IF Actual Cost < 90% and >75% of the budget , then "At Risk"
IF Actuals Cost < 75% of the budget, then "On Forecast"
IF Budget = 0 and Actuals > 15K (20,000 x 75%), then "At Risk"
Basically, I would like to have the output of the "Remark" column
Thank you
Hi hushpuppies
with "else" between the statements
Take a look at the linked tutorials:
https://www.youtube.com/watch?v=w57a_XheWz4https://www.youtube.com/watch?v=o9qAov3kSN4
According to your example if i understood you correctly it will be like this (you can modify the logic if you need).
1. In the first step I added a column of actual % :
2 And then the custom column :
result:
pbix is attached
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
hushpuppies
Create your remarks column using DAX as follows. You may add >= where necessary based on your scenario.Remark = SWITCH( TRUE(), 'Table07'[Budget] = 0 && 'Table07'[Actual] > 15000, "At Risk", 'Table07'[Actual] >= 'Table07'[Budget] * 0.9, "Issue", 'Table07'[Actual] < 'Table07'[Budget] * 0.9 && 'Table07'[Actual] > 'Table07'[Budget] * 0.75, "At Risk", 'Table07'[Actual] < 'Table07'[Budget] * 0.75, "On Forecast", BLANK() )Result:
4 Replies
- FowmySuper User
hushpuppies
Create your remarks column using DAX as follows. You may add >= where necessary based on your scenario.Remark = SWITCH( TRUE(), 'Table07'[Budget] = 0 && 'Table07'[Actual] > 15000, "At Risk", 'Table07'[Actual] >= 'Table07'[Budget] * 0.9, "Issue", 'Table07'[Actual] < 'Table07'[Budget] * 0.9 && 'Table07'[Actual] > 'Table07'[Budget] * 0.75, "At Risk", 'Table07'[Actual] < 'Table07'[Budget] * 0.75, "On Forecast", BLANK() )Result:
- hushpuppiesFrequent Visitor
It worked!! 🙂
Thank you Fowmy
- FowmySuper User
hushpuppies
Gald it worked!
Please accept it as a solution.
- Ritaf1983Super User
Hi hushpuppies
with "else" between the statements
Take a look at the linked tutorials:
https://www.youtube.com/watch?v=w57a_XheWz4https://www.youtube.com/watch?v=o9qAov3kSN4
According to your example if i understood you correctly it will be like this (you can modify the logic if you need).
1. In the first step I added a column of actual % :
2 And then the custom column :
result:
pbix is attached
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly