Forum Discussion
osuraperera86
3 years agoRegular Visitor
Nested Switch Function
I'm trying to calculate a dissatisfied value based on two criteria, Name and Year. Below is the formula I've written. For some reason, the values for 2019 and 2020 don't generate. Can anyone here hel...
daXtreme
3 years agoSolution Sage
This code has a lot of repetitions. Please tidy this up, make it shorter, remove repetitions. Instead of || use the IN operator. It's not possible to tell you where the problem is without actual data.
osuraperera86
3 years agoRegular Visitor
Thank you for your suggestion; the essence of the problem is when I nest a switch function, the values calculated through a variable work but not the typed values highlighted in orange.
switch(
SELECTEDVALUE('Combined Raw Data'[SL ABB]),
"GBS",
switch(
SELECTEDVALUE('Year For Summary'[Year]),
2019,0.0747,
2020,0.0408,
2021, Divide(HighlySatis,TotalResponses),
2022, Divide(HighlySatis,TotalResponses)
)