Are you looking for something like this?
if you can detail the formula for OtDirVarCost,GrossMargin and GM% it can also be achived.
Attached sample QVW.
SalesCost.qvw 154.5 K
almost that but in the table all the figures need to be 4 months cumulative figures from that month which column is back.
In the example below there's first the base table and next the one that I need. I made that one with 2 months cumulative values so that in the column 201208 & Sales it shows sales summary from months 201208 and 201207. Next one shows sales summary from months 201207 and 201206 and so on. Same with costs. OtDirVar is just then percent of the sales of that column and gross margins are calculated based on sales and cost data.
So is this possible?
And for the record I only have personal edition of qlikview at the moment so I can't open the example file you sent.
You have 2 requirements:
1. Cummulate the sum of measures going back 4 Months
2. Show only the last 4 months
The issue #1 can be achived by sing a RangeSum in your expression:
[4 - above represents the last 4 values]
Issue #2 can be achived by using Rank Operator in your calcualted dimension:
Ex., = =If(Aggr(Rank(Aggr(Max(MonthName),MonthName),0,1),MonthName)<=4, MonthName, null)
The problem arrises when you want both togther.
Since you are cutting off 1 month (201204) as per your example above the values for this will not be considered while calculating for 201205.
If you remove constraint on the dimension you will get proper values for 201205.