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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Jackbaz99
Helper I
Helper I

Losing Filtered Dates when using SWITCH

Hi, really struggling with this - but think im nearly there. Code im using is below - and picture is after that.

I am trying to get the newly created target line to follow the filtered dates onthe page - even if no data exists. This is what i have done for the rework cost. by using a calculated & filtered measure. However how can i do this with a switch command? so they line up.

 

Seems either one or the other is correct. When i filter by additional field this works perfectly - wut when filtering by customer i just want the relevant data to show without my Rework target. Any help would be great

 

Rework Target = 
SWITCH( TRUE(),
"A P" in allselected('Index_Part Information'[Additional_Field_2]) , 1000 ,
"AP Jet" in allselected('Index_Part Information'[Additional_Field_2]) , 150 ,
"SSO" in allselected('Index_Part Information'[Additional_Field_2]) , 500 ,
"LMT" in allselected('Index_Part Information'[Additional_Field_2]) , 500,
isblank(selectedvalue('Index_Part Information'[Additional_Field_2])) , 0)

 DPPM Test.png

 

4 REPLIES 4
Anonymous
Not applicable

Hi  @Jackbaz99 ,

You can change dax to the following form

Rework Target =
If(
ISFILTERED('Index_Part Information'[Additional_Field_2])=false(),0,
SWITCH( TRUE(),
"A P" in allselected('Index_Part Information'[Additional_Field_2]) , 1000 ,
"AP Jet" in allselected('Index_Part Information'[Additional_Field_2]) , 150 ,
"SSO" in allselected('Index_Part Information'[Additional_Field_2]) , 500 ,
"LMT" in allselected('Index_Part Information'[Additional_Field_2]) , 500,0
))

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Jackbaz99 , This Does not seem to have the impact on customer filter . But when nothing is selected you can try like

Check first line , isfiltered 

Rework Target = 
SWITCH( TRUE(),
not(isfiltered('Index_Part Information'[Additional_Field_2]), 0, 
"A P" in allselected('Index_Part Information'[Additional_Field_2]) , 1000 ,
"AP Jet" in allselected('Index_Part Information'[Additional_Field_2]) , 150 ,
"SSO" in allselected('Index_Part Information'[Additional_Field_2]) , 500 ,
"LMT" in allselected('Index_Part Information'[Additional_Field_2]) , 500,
isblank(selectedvalue('Index_Part Information'[Additional_Field_2])) , 0)

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak any help with the above please

@amitchandak it seems to not work - says the () expression is not supported. Otherwise i think this could work - when customer is selected it just stays blank which is what i need. Or is there a way i can put if any customer selected then 0 or something

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.