Forum Discussion

afaro's avatar
afaro
Icon for Helper III rankHelper III
1 year ago
Solved

Selectively filtering visual axis and measures from one slicer

I have a column Calendar[Month] which I add to the X axis of a line chart.  Then, I have two measures let's say -  1. Cumulative Revenue Last Year (I filter on the year directly using YEAR(TODAY())...
  • MarkLaf's avatar
    1 year ago

    afaro wrote:

    I want to do this by avoiding to create a detached new slicer duplicating Calendar[Month] only for Cumulative Revenue Present Year if possible. 


    This is impossible. You need a detached table.

     

    The underlying DAX (can check by copying visual's query in performance analyzer) being run is SUMMARIZECOLUMNS and the slicer selection is added as a filter table that applies to group by columns. There is currently no way to somehow make the TREATAS filter table not filter the group by columns when they are of the same table.

     

    // simplified DAX of visual with Calendar[Month] in x-axis and Calendar[Month] slicer
    SUMMARIZECOLUMNS(
    	Calendar[Month], // group by column
    	TREATAS( { < months selected in slicer > }, Calendar[Month]), // filter table from slicer
    	< added name,expression columns >
    )