Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
matthewp
Creator III
Creator III

Using Accumulate 12 steps back for MAT graph, but cant limit date range

I have a line chart which has two dimensions:

Yearperiod = 201601, 201602, 201603 etc etc

Acgroup = FAB, BOB, TOE, QUE etc

And one expression:

SUM(Quantity)

This also has Accumulate 12 steps back ticked.

Now the data i get in the chart is correct and is what i want my MAT to be.

However the line chart is showing all dates and i just want to limit it to the last 12.

I have tried doing this with a calculated dimension for Yearperiod like so:

=if(Yearperiod >= addmonths(today(),-6), Yearperiod )


But this didn't do anything.

Labels (1)
2 Replies
marcus_sommer
MVP
MVP

With this approach you would need to convert and format your date which you get through addmonths() like:

... year(addmonths(today(),-6)) * 100 + num(month(addmonths(today(),-6)), '00') ... // only 6 months ?


another way might be:


aggr(if(Yearperiod >= max(Yearperiod) - 100, Yearperiod), Yearperiod) // 12 months


- Marcus

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Perhaps like this:

sum({<YearPeriod={'>=$(=AddMonths(max(YearPeriod),-11))'}>}aggr(rangesum(above(sum({<YearPeriod=>}Quantity),0,11)),YearPeriod))


talk is cheap, supply exceeds demand