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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
g_f_bakker
Partner - Contributor
Partner - Contributor

Total over previous years

Hello,

I have a question and I really need some help.

When I use a table in a bar chart with the columns YEAR, PERIOD and QTY, I want to do the following with one expression:

If

YEAR < Max(YEAR)

then (Total QTY of that Year)

Else Sum(QTY)

Only the bar of Max(YEAR) must change when I put a selection on PERIOD.

My test file is attached.

Please help me, I think it’s something with the aggr function, but .....

Labels (1)
1 Solution

Accepted Solutions
deepakk
Partner - Specialist III
Partner - Specialist III

HI,

Try  out the attach application

Deepak

View solution in original post

4 Replies
deepakk
Partner - Specialist III
Partner - Specialist III

HI,

Try  out the attach application

Deepak

g_f_bakker
Partner - Contributor
Partner - Contributor
Author

Hi Deepak,

  

Absolutely BRILLIANT!!

Could you please explain this syntax? Sum({<YEAR={"< $(vMaxYear)"},PERIOD=>}QTY)

 

Many thanks, Gerard.

deepakk
Partner - Specialist III
Partner - Specialist III

Hi Gerard,

I am storing the max(year) inside variable vMaxyear. And using set analysis iam checking if Year < vMaxYear

and ignore the selection for period (PERIOD=) then sum of quantity.

Deepak

g_f_bakker
Partner - Contributor
Partner - Contributor
Author

Hi Deepak,

  

Again, many thanks!

  

Gerard.