Showing results for 
Search instead for 
Did you mean: 
Helper I
Helper I

Wrap a Switch statement into Calculate possible?



Is it possible to wrap the following:


Rework Target = 
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())



Helper I
Helper I



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

Super User
Super User

@Jackbaz99 , Create measure like

Rework Target =
"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 )

!! Microsoft Fabric !!
Microsoft Power BI Learning Resources, 2023 !!
Learn Power BI - Full Course with Dec-2022, with Window, Index, Offset, 100+ Topics !!
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!

@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

May 2023 update

Power BI May 2023 Update

Find out more about the May 2023 update.

Submit your Data Story

Data Stories Gallery

Share your Data Story with the Community in the Data Stories Gallery.

Top Solution Authors