Forum Discussion

Dooriya101's avatar
Dooriya101
Frequent Visitor
3 years ago

Multiple conditions in SWITCH ()

Hi Team,

 

I have a Case Table and Priority Table, and have a column chart to show average of Time, and have another DAX code to have colour settings like if actual time is within 50% of target time, then show green, if within 80% then yellow, else red.

 

So it looks like:

 

Pirority = "A" && Actual time <= 2*1.5, "Green",

Pirority = "A" && Actual time <= 2*1.8, "Yellow",

Pirority = "A" && Actual time > 2*1.8, "Red",

Pirority = "B" && Actual time <= 4*1.5, "Green",

Pirority = "B" && Actual time <= 4*1.8, "Yellow",

Pirority = "B" && Actual time > 4*1.8, "Red",

Pirority = "C" && Actual time <= 6*1.5, "Green",

Pirority = "C" && Actual time <= 6*1.8, "Yellow",

Pirority = "C" && Actual time > 6*1.8, "Red",

Pirority = "D" && Actual time <= 8*1.5, "Green",

Pirority = "D" && Actual time <= 8*1.8, "Yellow",

Pirority = "D" && Actual time > 8*1.8, "Red",

 

I'm wondering if this is right logic and if there is any simple way to write this? Thanks!

 

Priority Table

PriorityTarget Time
A2
B4
C6
D8

 

Case Table:

Case IDPriorityActual Time
001A1.5
002B4.8
003D22.2
004A0.7
005A5.5
006B3.3
007C6.1
008C2.4
009A2.2
010B9

2 Replies