Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I've Googled endlessly but seem unable to find a solution to my issue.
I have a table which holds records with a date field. I am using the QlikView Components qvs to generate my "master calendar" from the date field (CaseDate).
The user can select Year, Month and Day to filter the various charts/tables on the report.
However, I want one chart to show a sum of figures based on the max date the person selects. The chart should show the 12 months leading up to the selected date as the CY and the 12 months prior to that as the PY.
For example, if the user selects Year=2017, Month=Feb then I want the following data:
Current Year = Total records Mar-2016 to Feb-2017
Previous Year = Total records Mar-2015 to Feb-2016
Now, I can get this information using a Set Analysis but if I just return the month name then I can't get it to sort with Mar first and Feb last. If I return the year to sort then I get 24 records rather than 12:
CaseYear-Month | CY | PY |
2015-Mar | 0 | 210 |
2015-Apr | 0 | 171 |
2015-May | 0 | 189 |
2015-Jun | 0 | 244 |
2015-Jul | 0 | 228 |
2015-Aug | 0 | 169 |
2015-Sep | 0 | 224 |
2015-Oct | 0 | 224 |
2015-Nov | 0 | 222 |
2015-Dec | 0 | 183 |
2016-Jan | 0 | 210 |
2016-Feb | 0 | 243 |
2016-Mar | 213 | 0 |
2016-Apr | 204 | 0 |
2016-May | 202 | 0 |
2016-Jun | 212 | 0 |
2016-Jul | 218 | 0 |
2016-Aug | 196 | 0 |
2016-Sep | 223 | 0 |
2016-Oct | 197 | 0 |
2016-Nov | 226 | 0 |
2016-Dec | 174 | 0 |
2017-Jan | 216 | 0 |
2017-Feb | 207 | 0 |
I've attached a screenshot to try and show the issue.
Can anyone point me in the right direction?
Many thanks,
Phil
grrrrr so close
What are we trying to do here Adam?
Order the months ending with the selected months basically!
GOT IT!
I'll tidy this up
Not sure but may be this
If(Num(Only({1}MonthName))-Min(TOTAL MonthName) >= 0, Num(Only({1}MonthName))-Min(TOTAL MonthName), Num(Only({1}MonthName))-Min(TOTAL MonthName)+12)
or
If(Num(Only({1}MonthName))-Min(TOTAL MonthName) > 0, Num(Only({1}MonthName))-Min(TOTAL MonthName), Num(Only({1}MonthName))-Min(TOTAL MonthName)+12)
pahahahahaha so much simpler than mine, I think I went down this route but didn't twig on using TOTAL
This is the correct one I believe, makes sense how that works
If(Num(Only({1}MonthName))-Min(TOTAL MonthName) > 0, Num(Only({1}MonthName))-Min(TOTAL MonthName), Num(Only({1}MonthName))-Min(TOTAL MonthName)+12)
It can be further simplified by removing Num() which I used for testing purposes
If(Only({1}MonthName)-Min(TOTAL MonthName) > 0, Only({1}MonthName)-Min(TOTAL MonthName), Only({1}MonthName)-Min(TOTAL MonthName)+12)
No need to show off 😉
what about this sortorder:
=Mod(Only({1}MonthName)-Min(TOTAL MonthName+1),12)+1
adamdavi3s - Look who is showing off now