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
Anonymous
Not applicable

Calculate measure based on filter through DAX

Hi ,

 

I have a visual , something like this

priyanath1988_0-1674612218342.png

This YTD changes value depending upon the value selected in the slicer which is coming froma table "_Sort_Summary". for example if someone selects "Case" , it will show YTD for Case, if some one slected "Volume", it will show YTD for Volume.

_NSR_filtered_Measure_YTD is a filtered measure , something like this
_NSR_filtered_Measure_YTD =
 VAR M= "Net Surgery Revenue"
 RETURN
 TOTALYTD( CALCULATE(SUM(_Pivot_Summary[Value]),REMOVEFILTERS('_Sort_Summary'), FILTER(_pivot_Summary, _Pivot_Summary[Attribute]= M)), 'Calendar'[Date])
 
so, when Net Surgery Revenue is selected through the silcer the measure _NSR_filtered_Measure_YTD shows the value but when somehting else is selected it becomes blank. I want to show _NSR_filtered_Measure_YTD no matter what slicer value has been selected.
Could someone pls tell me whats wrong am I doing?
 
Thanks
2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , based on what I got

 

_NSR_filtered_Measure_YTD =
VAR M= "Net Surgery Revenue"
RETURN
TOTALYTD( CALCULATE(SUM(_Pivot_Summary[Value]),REMOVEFILTERS('_Sort_Summary'), FILTER(all(_pivot_Summary), _Pivot_Summary[Attribute]= M)), 'Calendar'[Date])

 

 

If this does not help
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

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
Anonymous
Not applicable

@amitchandak Thanks for your response. I see value now but  value does not seems to be correct. Looks like its aggregating but I am not undersatnding on what level. Values should look like "YTD" in the screen shot

priyanath1988_0-1674616404076.png

 

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.