Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
NewtoROB
New Member

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 ...

NewtoROB_0-1769198971245.png

But when I click on the Median I get ...

NewtoROB_1-1769199055916.png

Using the mesure only without the switch does show the data 

NewtoROB_2-1769199179365.png

The Switch code is

"SWITCH(VALUES('Calculation Method'[Calc Method]),"Average",[Average Wait List],"Median",[Median Wait List])"

 

How do I fix it ?

1 ACCEPTED SOLUTION
NewtoROB
New 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 

View solution in original post

6 REPLIES 6
NewtoROB
New 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 

cengizhanarslan
Super User
Super 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] 
)
_________________________________________________________
If this helped, ✓ Mark as Solution | Kudos appreciated
Connect on LinkedIn
AI-assisted tools are used solely for wording support. All conclusions are independently reviewed.
hnguy71
Super User
Super User

Hi @NewtoROB 

Could be a few issues.

 

On the top of my head, issues could be relating to:

  1. the measure itself not returning the correct value
  2. the slicer is filtering out the required information
  3. you may need to disconnect the slicer from the model

 

Would you be able to provide a sample model?



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!
Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
pankajnamekar25
Super User
Super 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

 

 thanks for the response, however it didnt fix it 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.