Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Uploads getting stuck in the virus scanner. We are investigating.
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor III
Contributor III

Last 4 weeks variable issue

Hi all,

I'm trying to use a "last 4 weeks" variable but i'm encoutering issues with syntax I think.

I've tried this :

num(SUM({<[WeekNumber]={">$(=$(vMaxYearWeekID)-4)<=$(=$(vMaxYearWeekID))"}>}[Invent.Qty]))

My MaxYearWeekID variable looks like this :

=max( {1} YearWeekId)

What am I doing wrong?

Thank you in advance for the help.

Best regards,

1 Solution

Accepted Solutions
Highlighted
Contributor III
Contributor III

The problem was somewhere else in my master calendar.

It is solved now.

Thank you for you time youssefbelloum

View solution in original post

7 Replies
Highlighted
Champion
Champion

Hi,

the approach is ok, variable ok, expression ok, what do you see on the chart ?

Highlighted
Contributor III
Contributor III

The value displayed is 0.

But when I put the "YearWeekID" field in a filter pane and select the last 4 weeks, I get a good value.

Highlighted
Champion
Champion

do you have all the weeks on your data ?

example:

Measure, Week

100,1

200,2

120,3

210,4

340,5

145,6

125,7

574,8

195,9

354,10

165,11

==> here all weeks are available, you will see 4 lines as expected on the graph

or yo don't have all the weeks, like this:

Measure, Week

100,1

200,2

120,3

210,4

340,5

145,6

276,7

310,9

174,11

==> here week 8 and week 10 are missing.. so using your expression, you will only see two lines on the graph

Highlighted
Contributor III
Contributor III

I do have all the weeks, numbers from 1 to 813.

And when I pick manualy the weeks 813 - 812 - 811 - 810, I see a result in my KPI.

Screenshot_1.png

With production KPI like :

num(SUM([Invent.Qty]))

Highlighted
Champion
Champion

Would you be able to share sample app the see the issue ?

Highlighted
Contributor III
Contributor III

The problem was somewhere else in my master calendar.

It is solved now.

Thank you for you time youssefbelloum

View solution in original post

Champion
Champion

no problem, good luck