Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a chart with the following structure. In the column to the right I want to sum the sale for the current month + the sale for the 2 next months. E.g. 2013-01 should show 22 (5+10+7)
Month | Sales | Sales within 3 months |
---|---|---|
2013-01 | 5 | 22 |
2013-02 | 10 | |
2013-03 | 7 | |
2013-04 | 2 |
How should I do this?
You can create a new dimension with quarter function... Let me know if it work for you.
- Javier Florian
Try:
RangeSum(below([Sales], 0, 3))
Carlos, this doesnt work for me as I need to be able to select just one month and still show the right amount. Is it possible to do something similar with set analysis?
Something like this?
Sum({$<YearMonth={">=$(YearMonth)<=$(=Date(AddMonths(YearMonth),+2))"}>}Sales)
Hi, Anton
Carlos Alberto is right. You can learn more about accumulate rolling n-period total at here :
http://community.qlik.com/docs/DOC-4252
Wish it help.
Regards,
Zhou
Thank you Zhou for the link.
The AsOf example is the way I need to do it, not rangesum.
"The 'problem' is that the set is calculated once for the entire chart, not per row. This means that it's not possible here to use Month both as a dimension and in the set modifier in the expression.
There's still an option left to discuss: AsOf tables."