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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Jackbaz99
Helper I
Helper I

Wrap a Switch statement into Calculate possible?

Hi,

 

Is it possible to wrap the following:

 

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

 

into a calculated/filtered measure with the following filter 

 

FILTER('Date Table','Date Table'[Date] <= TODAY())

 


Thanks

3 REPLIES 3
Jackbaz99
Helper I
Helper I

@amitchandak 

 

I think the issue lies with the other values on the graph whic is as below 

 

 

Rework Cost = SUMX(FILTER('Date Table','Date Table'[Date] <= TODAY()),CALCULATE(SUM('Sub_NCR'[CST_GT_Rework])) + 0 )

 

 

This is giving me row context so i can show values as 0 (as we discussed earlier) but now i have the same problem when doing the rework target line - i can get the measure to work, however it now shows the all the dates even if ive filtered to last 12 calendar months

amitchandak
Super User
Super User

@Jackbaz99 , Create measure like

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])) , 500 )

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 Hi, this does work - however i still need filtered between the dates. 

The rework target line stays filtered to all dates regardless of what my date filter says on the page which is the last 12 calendar months.

 

How can i do this please?

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors