Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Calculate measure based on filter through DAX

Hi ,

 

I have a visual , something like this

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

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

    • Anonymous's avatar
      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