Forum Discussion
Switch issues
I am new Power BI so the answer may be obvious. I have two indivdual mesures which work (one shows the average of the data, the other shows the median). however am having issues when using a switch.
When I click on Average the data show ...
But when I click on the Median I get ...
Using the mesure only without the switch does show the data
The Switch code is
"SWITCH(VALUES('Calculation Method'[Calc Method]),"Average",[Average Wait List],"Median",[Median Wait List])"
How do I fix it ?
Thanks for all the response, the solution was a ghost space. the 'Calculation Method' table actually had a leading space (e.g., " Median"). Now it's working
6 Replies
- NewtoROBNew Member
Thanks for all the response, the solution was a ghost space. the 'Calculation Method' table actually had a leading space (e.g., " Median"). Now it's working
- pankajnamekar25Super User
Hello NewtoROB
Try this DAX
Selected Wait List :=
SWITCH(
SELECTEDVALUE('Calculation Method'[Calc Method]),
"Average", [Average Wait List],
"Median", [Median Wait List]
)
If my response helped you, please consider clicking
Accept as Solution ✅ and giving it a Like 👍 – it helps others in the community too.
Thanks,
Connect with me on:
LinkedIn- NewtoROBNew Member
thanks for the response, however it didnt fix it
- Ashish_MathurSuper User
Hi,
Share the download link of the file.
- hnguy71Super User
Hi NewtoROB
Could be a few issues.
On the top of my head, issues could be relating to:
- the measure itself not returning the correct value
- the slicer is filtering out the required information
- you may need to disconnect the slicer from the model
Would you be able to provide a sample model?
- cengizhanarslanSuper User
Please try the measure below:
Avg/Med Wait List = VAR _method = SELECTEDVALUE ( 'Calculation Method'[Calc Method], "Average" ) RETURN SWITCH ( _method, "Average", [Average Wait List], "Median", [Median Wait List], [Average Wait List] )