Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Mlan
Contributor
Contributor

Show 10 latest weeks

Hi, 

 

I am new to Qlik Sense and could really need your help. I have a combo chart that shows hours per week .  The bars shows the actual hours per week and the line shows targeted hours. 

I want to show the 10 latest weeks. 

My problem is, for actual hours I have data until w 43 this year but for the target I have data until w 52 in 2020. 

I want to show week 35 - 43 but not show the weeks before or after. 

My measure looks like this for actuals (the bar): 

sum({<Scenario_W={Actual}>} HpT_W )

And like this for target (the line):

sum({<Scenario_W={Target}>} HpT_W )

Can anyone help me? 

 

Labels (1)
1 Solution

Accepted Solutions
Mauritz_SA
Partner - Specialist
Partner - Specialist

Hi there

I took your original expression, but the Actual and Target values may need to be in singe quotes i.e. {'Target'} and replace the [Time Field] with your actual date field.

Actual:

Sum({<Scenario_W={Actual},[Time Field] = {"=WeekName([Time Field])>WeekName(Now())-7*10 AND WeekName([Time Field])<=WeekName(Now())"}>} HpT_W)

Target:

Sum({<Scenario_W={Target},[Time Field] = {"=WeekName([Time Field])>WeekName(Now())-7*10 AND WeekName([Time Field])<=WeekName(Now())"}>} HpT_W)

Hope this helps.

Regards,

Mauritz

View solution in original post

1 Reply
Mauritz_SA
Partner - Specialist
Partner - Specialist

Hi there

I took your original expression, but the Actual and Target values may need to be in singe quotes i.e. {'Target'} and replace the [Time Field] with your actual date field.

Actual:

Sum({<Scenario_W={Actual},[Time Field] = {"=WeekName([Time Field])>WeekName(Now())-7*10 AND WeekName([Time Field])<=WeekName(Now())"}>} HpT_W)

Target:

Sum({<Scenario_W={Target},[Time Field] = {"=WeekName([Time Field])>WeekName(Now())-7*10 AND WeekName([Time Field])<=WeekName(Now())"}>} HpT_W)

Hope this helps.

Regards,

Mauritz