Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum analysis based on varied week periods

Hello,

I have a database which stores week periods (nice week), calendar weeks(week_class - i.e current week (shown as 0 below), week-1 (1),week-2 etc etc) and a calculated sum for each week .

I want to be able to click on nice week (i.e. 27 Feb shown as 8 below) and to be able to view both the current week (0) and the previous weeks (1) sum for comparison analysis in 2 LED text boxes.

So if you click on nice week (27 Feb), you should also be able to see the previous weeks calculation for 20 Feb (i.e. week-1), if you click on nice week (20 Feb), you see the previous weeks calculation for 13 Feb (i.e. week-2).

Nice_Week

Week_Class

SUM(hours)

1

8

30776.9

1

7

120457.95

2

6

122365.44

3

5

121784.74

4

4

121433.24

5

3

121072.44

6

2

121225.07

7

1

122302.43

8

0

120873.39



I have tried various expressions relating to SUM(IF(Week_Class ='current week',(hours)))

SUM(IF(Week_Class ='Week-1',(hours))) etc etc

as an expression in the text box but it only works if you select both applicable nice weeks at the same time. I would like to be able to click on only 1 nice week option and have Qlikview automatically recognise to display that weeks sum and the previous week.

Appreciate this is probably straightforward but I have recieved no training with this and although I have made progress, I'm getting to the point where Qlikview is becoming a verb but not a pleasant one!

Thanks for any help.

Matt

3 Replies
deepakk
Partner - Specialist III
Partner - Specialist III

hi,

Try this code.

for current Week :

Sum({<Week_Class ={$(=Max(Week_Class))}>} Value)

for Previous Week

Sum({<Week_Class ={$(=Max(Week_Class)-1)}>} Value)



Not applicable
Author

Thanks Deepak but I'm afraid your suggested code is returning zero values.

deepakk
Partner - Specialist III
Partner - Specialist III

Hi

Can you attach a sample application. Chekc by selecting multiple weeks...

It should work fine...