Forum Discussion
How to get multiple results from SWITCH() function?
- 5 years ago
The logic behind switch is this:
if value equals X than "show me this", otherwise
if value equals Y than "show me that", ...
What you've wrote is this:
if value equals X than "show me this", otherwise
if value equals X than "show me that", ...
However this cannot work since X cannot equal 2 conditions at the same time. You cannot have "CRT" 3 times and "% Share Volume" also 3 times.
You need to create 3 separate switch functions:
Upper Bound = switch( SELECTEDVALUE(Range[Metric]), "CRT", 'Verizon Call Reason'[YMax CRT], "% Share Volume",'Verizon Call Reason'[YMax V%], 0 )Lower Bound = switch( SELECTEDVALUE(Range[Metric]), "CRT", 'Verizon Call Reason'[YMin CRT], "% Share Volume", 'Verizon Call Reason'[YMin V%], 0 )Average = switch( SELECTEDVALUE(Range[Metric]), "CRT", 'Verizon Call Reason'[Avg CRT], "% Share Volume", 'Verizon Call Reason'[Avg V%], 0 )
The logic behind switch is this:
if value equals X than "show me this", otherwise
if value equals Y than "show me that", ...
What you've wrote is this:
if value equals X than "show me this", otherwise
if value equals X than "show me that", ...
However this cannot work since X cannot equal 2 conditions at the same time. You cannot have "CRT" 3 times and "% Share Volume" also 3 times.
You need to create 3 separate switch functions:
Upper Bound =
switch(
SELECTEDVALUE(Range[Metric]),
"CRT", 'Verizon Call Reason'[YMax CRT],
"% Share Volume",'Verizon Call Reason'[YMax V%],
0
)Lower Bound =
switch(
SELECTEDVALUE(Range[Metric]),
"CRT", 'Verizon Call Reason'[YMin CRT],
"% Share Volume", 'Verizon Call Reason'[YMin V%],
0
)Average =
switch(
SELECTEDVALUE(Range[Metric]),
"CRT", 'Verizon Call Reason'[Avg CRT],
"% Share Volume", 'Verizon Call Reason'[Avg V%],
0
)- Anonymous5 years agoNot applicable
This worked like a charm!