0 Replies Latest reply: Jun 7, 2017 3:11 AM by Tereza Gregorova RSS

    MAT calculation in Pivot table

    Tereza Gregorova

      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!