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
what about this sortorder:
=Mod(Only({1}MonthName)-Min(TOTAL MonthName+1),12)+1
Hi Phil,
Do you have month number in your master calendar? If not then add it and use a sort on expression
=only({1}MonthNo)
Actually one thing I have never tried is just a sort on expression using
=Num(Month)
That might also work!
Ignore me, that will still put feb first, let me install the components script and see what we have to work with!
Thanks Adam.
Yes, this is the problem I'm having. The month number will always put Jan first. As I don't know what the first month is until the user makes a selection, I can't use a pre-populated field.
Hi Phil,
Can you just clarify what fields you've got in the calendar and what set you're using to return the values.
These are the fields in the calendar. It links to the fact table using the CaseDate field.
If I return using the CaseYear_Month then I can sort, but I get 24 records, i.e. the PY and CY. If I return the CaseMonth column (Jan;Feb;Mar;etc,) then it does group into 12 records correctly but I can't sort it.
Many thanks,
Phil
This is making me so cross, there HAS to be a way
can u prepare a small example qvw to play around.
i guess this way you will get a solution much faster
This is the one I made to play with (Remember ctrl+q+q) , you're welcome to use it
Its going to be something insane like
=pick(match(Month,'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'),Match(only({1}MonthName),'February','March','April','May','June','July','August','September','October','November','December','January'),Match(only({1}MonthName),'March','April','May','June','July','August','September','October','November','December','January','February'),Match(only({1}MonthName),'April','May','June','July','August','September','October','November','December','January','February','March'),Match(only({1}MonthName),'May','June','July','August','September','October','November','December','January','February','March','April'),Match(only({1}MonthName),'June','July','August','September','October','November','December','January','February','March','April','May'),Match(only({1}MonthName),'July','August','September','October','November','December','January','February','March','April','May','June'),Match(only({1}MonthName),'August','September','October','November','December','January','February','March','April','May','June','July'),Match(only({1}MonthName),'September','October','November','December','January','February','March','April','May','June','July','August'),Match(only({1}MonthName),'October','November','December','January','February','March','April','May','June','July','August','September'),Match(only({1}MonthName),'November','December','January','February','March','April','May','June','July','August','September','October'),Match(only({1}MonthName),'December','January','February','March','April','May','June','July','August','September','October','November'),Match(only({1}MonthName),'January','February','March','April','May','June','July','August','September','October','November','December')
)
stalwar1 save me from myself.....