Forum Discussion
Anonymous
2 years agoNot applicable
Column not appearing in SWITCH function
Hi there, I am having some issues with SWITCH funtion. I am trying to categorise NPS by score using SWITCH function - NPS Category = SWITCH( TRUE(), 'Data'[NPS] >= 9, "Promoter", 'Data'[NPS...
- 2 years ago
Hi Anonymous
Download PBIX file with example below
The DAX needs you to give it a single value for NPS - it shoudl have been giving you that error message?
Try this, works for me
NPS Category = VAR _nps = SELECTEDVALUE('Data'[NPS]) RETURN SWITCH( TRUE(), _nps >= 9, "Promoter", _nps >= 7 && _nps < 9, "Passive", "Detractor" )Regards
Phil
PhilipTreacy
2 years agoSuper User
Hi Anonymous
Download PBIX file with example below
The DAX needs you to give it a single value for NPS - it shoudl have been giving you that error message?
Try this, works for me
NPS Category =
VAR _nps = SELECTEDVALUE('Data'[NPS])
RETURN
SWITCH(
TRUE(),
_nps >= 9, "Promoter",
_nps >= 7 && _nps < 9, "Passive",
"Detractor"
)
Regards
Phil