Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I want to create a trend graph showing a weeks sales by date for this year, and the same equivalent week last year. I have data that is (basically)...
Date | Sales (TY) | Sales (LY) |
---|---|---|
1 Feb 2012 | 120 | |
2 Feb 2012 | 130 | |
3 Feb 2012 | 140 | |
4 Feb 2012 | 150 | |
5 Feb 2012 | 160 | |
6 Feb 2012 | 170 | |
7 Feb 2012 | 180 | |
3 Feb 2013 | 210 | |
4 Feb 2013 | 220 | |
5 Feb 2013 | 230 | |
6 Feb 2013 | 240 | |
7 Feb 2013 | 250 | |
8 Feb 2013 | 260 | |
9 Feb 2013 | 270 |
In the chart I'm using a dimension that shows each date in the format 'dd MMM' so that the years overlap, so it should look like...
But in qlikview the dates appear in the wrong order on the x-axis. I can't sort them by date because, for example, 9 Feb last year occurs before 1 Feb this year.
Can anyone offer any advice?
Thanks
Darren
(missing image)
Darren,
You need to create a year-independent "date" in your calendar, and use it in the chart. To keep it in a valid date format, just use any year. In the example here I use year 0 (as good as any):
date(MakeDate(0, month(Date), day(Date)), 'DD MMM') as ChartDate
Regards.
Michael