Forum Discussion
DAX IF statement help
- 8 years ago
Hi acalderon
I hope this would help you.
Dax Function:
Overall Status = IF(OR(OR(Sheet1[Budget status]="Red",Sheet1[Schedule status]="Red"),Sheet1[Scope status]="Red"),"Red",IF(OR(OR(Sheet1[Budget status]="Yellow",Sheet1[Schedule status]="Yellow"),Sheet1[Scope status]="Yellow"),"Yellow","Green"))
Report Link for your reference: https://app.powerbi.com/groups/me/reports/b1a5f4ce-0642-4844-b828-b2563e768479?ctid=470e1ac4-5b55-48e8-b282-4522b5248639
OverallStatus = Var Status1 = Projects[BudgetStatus]
Var Status2 = Projects[ScopeStatus]
Var Status3 = Projects[ScheduleStatus]
Var OverallStatus = SWITCH(TRUE(),
Status1 = "Green" && Status2 = "Green" && Status3="Green", "Green", Status1)
Return OverallStatus
I tested the above code out with a project that had schedule status as yellow, but it still returned overall status as "Green"
my understanding from the above is that variables status1, status2 and status3 hold a value for whatever color status it is
the bolded part is where i'm confused, is there something i'm missing to tell it to return red or yellow if either of the variables is red or yellow?
Use the Dax function with OR function as given above.
I hope i will work.