Forum Discussion

QuantamPulse's avatar
QuantamPulse
Regular Visitor
2 years ago
Solved

Question about displaying previous year data over current year data

I have an issue displaying previous year data over current year data for a date range selected in a slicer. 

 

I use the following to set up the measures and have them set to display on a line graph. 

 

Sakes Data Count Current Year = COUNTROWS(requestTable)
Sales Data Count Previous Year = CALCULATE(
    COUNTROWS(requestTable),
    FILTER(
        ALL(requestTable),
        YEAR(requestTable[Date]) = YEAR(MAX(requestTable[Date])) - 1
        && FORMAT(requestTable[Date], "MMM") = FORMAT(MAX(requestTable[Date]), "MMM")
    )
)

 

 

And this works fine until another filter is applied, for example, a Needs slicer. The current year data adjusts, but the previous year data does not. I have tried chaning ALL to ALLSELECTED instead, but them the entire line on the chart for the previous year disappears. 

 

Not sure what I am doing wrong here but any help would be appriciated. 

 

4 Replies

    • QuantamPulse's avatar
      QuantamPulse
      Regular Visitor

      Never used ALLEXCEPT before. Worked perfectly. Set the column in the parameters to the column that I needed filtering by and it worked like a charm. 


      Thanks!

    • QuantamPulse's avatar
      QuantamPulse
      Regular Visitor

      Do you happen to know if you can specify multiple columns in the ALLEXCEPT function? The documentation on it is a little unclear. 

       

      The documentation shows the following context but I'm not sure why there would be a comma inside of a bracket?

      ALLEXCEPT(Table, Column1 [,Column2]...)