Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Dynamic Dimension for chart to show last 5 weeks from selected Week

Hi all,

I have been trying to create a dynamic dimension for a chart that will consistently show 5 weeks regardless of selection.

I can get the chart to show me last 5 weeks from the most recent week no problem, weeks 26, 25, 24, 23 and 22. But when I select a specific week, it will only show one week (obiviously)

What I want to be able to do if possible is if week 22 is selected for example, have the chart display weeks 22, 21, 20, 19 and 18, always having 5 weeks available.

Hope this makes sense. Any help would be greatly appreciated.


Thanks.

2 Replies
zhadrakas
Specialist II
Specialist II

you can create a variable

maxWeek = max(week)

Your dynamic Dimension:

if(week >= $(maxWeek)-5, week)

That should do the trick.

Think about using a WeekYear field. Then you have no Problem to Show weeks 51,52,1,2,3

regards

tim

arvind_patil
Partner - Specialist III
Partner - Specialist III

HI ,

You need to create dynamic dimension.

as suggested above by Tim:


if(week >= $(maxWeek)-5, week)


Thanks,

Arvind Patil