Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Coming your way, the Qlik Data Revolution Virtual Summit. October 27-29. REGISTER
Showing results for 
Search instead for 
Did you mean: 

MAT calculation in Pivot table

Hi all,

I am using in the script the AsOfTable that is recommended to use for MAT here: The As-Of Table

I have implemented the table in my load script. Now what I am trying to achieve is to create a Pivot table in Qlik Sense where using this MAT calculation: Rangesum( Before( Total Sum({$<MonthDiff={"<12"}>}sales),0,12))

The calculation above works fine when until I make selection on Year or Month. At that point, I am not getting anymore MAT for the previous 12 Months, but instead MAT starting from e.g. Jan of the selected Year.

If I implement Rangesum( Before( Total Sum({$<MonthDiff={"<12"}, Year=>}sales),0,12)), this does not narrow down the table when making selections as it's ignoring my Year selection.

So what I am trying to achieve is to have MAT that would still ignore the Year, however narrow down the table to selected year.

Is there any way how to achieve this in the calculation? Or do I need to calculate this in the load script?

Thanks for help!

0 Replies