Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I have been asked by a user to write a report which shows....
End Jan 2010 - Total of Previous 12 Month Sales to End Jan 2010
End Dec 2009 - Total of Previous 12 Month Sales to End Dec 2009
End Nov 2009 - Total Previous 12 Mmonths Sales to End Nov 2009
Going back to March 2008 (our QVD extract takes into account April 2007)
Sort of like 12 months rolling sales but showing what the figures are for each historical month...
I have two tables...
Calendar and Sales Invoice
These are joing by a field called %AnalysisPeriodKey which eqates to the financial year / period.
200901 = April 2009, 200902 = May 2009 and so on...
In my calendar table, I have a sequence field which 1 = April 2007, 2 = May 2007 and so on...
Would appreciate some guidance on how I can achieve this...
Paul Kelly wrote: I think that this may be the reason I am getting what I am getting with above...
Yes, that's why you're getting what you're getting with above(). Above() in a pivot table refers to the current "column segment". The column segment is all values of the last dimension in the context of a single value of the previous dimension, if I remember correctly.
In Excel at least, your Period field is the same as the month. It displays as 200910, while the month displays as Jan-10. Above can ONLY select months within the current period. The period is only a month. Therefore, the above() function can't return any more than the current cell, the current month.
Why is the period dimension there at all? It is more than a month in your actual chart?
Thanks for the response John...
Financial Year Period and MonthYear are there because some of our users prefer working with financial year period (200910) whilst some prefer to see the month year (January 2010) - trying to keep evryone happy...
I have playing around today trying to crack this with no success - the spreadsheet I attached ealier "QlikView Example.xls" (Feb 10 @ 8:36) shows what I am trying to achieve...
Set analysis may solve this for me but we will not be upgrading to version 9 for at least another 6 weeks...
Any assistance in cracking this would be grateful...
How about creating a cyclic group with Financial Year Period and MonthYear in it, and use the cyclic group as the dimension? Then the users can select which one they want to use, and as a side effect, it should cure your rolling 12-month headache.
And no, set analysis won't crack it. A set is calculated once for the entire chart. So if you make a "last 12 month" set, every row/column in your chart will use the SAME 12 months. You could crack it with a month island, but I think that's the wrong solution.
Thanks John
I have mocked up the live report from work at home using QlikView 9 Personal Edition (I hope this can be opened by other licensed users)..
I have also attached a spreadsheet which shows the expected results for the MAT expression......
(this is in the post below - still haven't workied out how to add two files)
Would appreciate assistance on what the formula for this row should be ....
expected results
Bah! I didn't think above(), below(), before() and after() were sensitive to the orientation of the pivot chart itself. I thought they were fixed based simply on the order of the dimensions. I was wrong.
So, in this case, your months are sorted in descending order, and they're laid out horizontally. Therefore, you need to use after() instead of above() to pick up the data in the columns that occur after this one. I suppose that's more intuitive, but it leads to data that changes if you start pivoting.
So I got the results with:
rangeavg(after(sum(sin_Sales),0,12))
Since it can compute an average even with less than 12 months, it does, so if you really want zero for the first eleven months, you'll have to play with it further.
Thanks John - you have made a young man very happy....
I have a calendar sequence field in my live report - can probably say if this is less than 12 do not calculate to prevent this appearing if below 12 months...
Thanks to everone else who helped....
Hello John,
Just a note to thank you for your post/solution on this subject. I was beginning to think what I required was impossible but this pointed me in correct direction. I hadn't realised how powerfull the combination of range and inter-record functions could be.
Not the first time one of your posts has helped me out.
Regards, Paul.
John:
I understand that this post is quite old, but is there a way to chart the rangeavg results (MAT in your test file) in a Bar Chart?
Thank you,
Braden
how to go if i want zero for the first eleven months