3 Replies Latest reply: Mar 3, 2011 7:08 AM by Deepak Kurup

# 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 120458 2 6 122365 3 5 121785 4 4 121433 5 3 121072 6 2 121225 7 1 122302 8 0 120873

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

• ###### Sum analysis based on varied week periods

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)

• ###### Sum analysis based on varied week periods

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

• ###### Sum analysis based on varied week periods

Hi

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

It should work fine...