Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
rasmusnielsen
Partner - Creator
Partner - Creator

Line chart with last 52 weeks, Compare with last year

Hi guys,

I have attached a test app, which shows volume distribution for the last two years (Chart 1).

I am attempting in Chart 2 and 3 to show volume distribution for the last 52 weeks with two lines: this year and last year.

This year = last 52 weeks

Last year = The same 52 weeks, the year before.

Measures:

This year

Avg({$<Date={">=$(=Date(Today()-365, 'DD/MM/YYYY'))"}>}Volume)

Last year

???

So, the last data point in the chart is current week vs same week last year, and the entire charts contains a total of 52 data points (one for each week)

How do I do that?

Best Regards,

Rasmus

Screen Shot 2018-09-19 at 14.53.27.pngScreen Shot 2018-09-19 at 14.54.29.png

1 Solution

Accepted Solutions
mikaelsc
Specialist
Specialist

use week(yourDateField) as Dimension.

otherwise you're showing 2 Measures that will only give results for the correcponding year

View solution in original post

2 Replies
mikaelsc
Specialist
Specialist

use week(yourDateField) as Dimension.

otherwise you're showing 2 Measures that will only give results for the correcponding year

rasmusnielsen
Partner - Creator
Partner - Creator
Author

Thanks for your help.

I actually already tried this, but wanted the current week to be the last point of the chart. If we only use week(date) then week 52 will always be the last point on the chart.

But I managed to fix it with this addition to my calendar:

Dual(Replace(WeekName($1), '/', '-'), Mod(52-(Week(Today()) - Week($1) + 1), 52)) AS [WeekL52] Tagged ('$axis', '$weekl52')

So, this will shift the weeks, so that current week becomes "week 52" and thereby the last point on the chart.