Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Stop calc at current year max week number

Hello experts,

I want to compare data from two distinct years, but only to the latest week from the current year.

So if I have 9 weeks of data in the current year I want to stop the calculation at week 9 in each year.

I've attached a Qvw to explain more fully.

Hopefully this is self explanatory.

Cheers.

1 Solution

Accepted Solutions
maxgro
MVP
MVP

I think the expression for 2014/15 should be (look at the image)

sum({< FinYear = {'2014/15'}, FinWeek={"<=$(=(max({$ <FinYear={'$(=maxstring(FinYear))'}>} FinWeek)))"} >} Count)


Replace the same expression in the difference

1.png

View solution in original post

7 Replies
sinanozdemir
Specialist III
Specialist III

Hi Jeff,

Is this what you are looking for?

Capture.PNG

Calculation stops at week 9.

I am attaching the qvw as well.

Thanks

maxgro
MVP
MVP

I think the expression for 2014/15 should be (look at the image)

sum({< FinYear = {'2014/15'}, FinWeek={"<=$(=(max({$ <FinYear={'$(=maxstring(FinYear))'}>} FinWeek)))"} >} Count)


Replace the same expression in the difference

1.png

sunny_talwar

May be this as your expression:

If(sum({< FinYear = {'2015/16'}>} Count) > 0, sum({< FinYear = {'2015/16'}>} Count) - sum({< FinYear = {'2014/15'}>} Count))

Capture.PNG

sunny_talwar

or this should also work:

If(Len(Trim(Avg({< FinYear = {'2015/16'}>} Count))) > 0, sum({< FinYear = {'2015/16'}>} Count) - sum({< FinYear = {'2014/15'}>} Count))


Capture.PNG

Not applicable
Author

Hi MaxGro - thanks for this very much appreciated - just what I was looking for.

Not applicable
Author

Thanks Sinan not quite the way I needed this time, thanks for the pointers in any case.

J.

Not applicable
Author

Thanks Sunny - both examples work - and the principles you employed will be helpful as I develop the overall dash.

Cheers

J.