Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Max function as variable in chart ignoring dimension

I have a straight table where i have to show sum over a date range. The starting point of date is fixed (4th highest date) but end point variable. (like 7th or 10th highest date) depending on a field called SIT.

So, I store variable as vSIT = SIT

=sum({<W_Period={">=$(=max(W_Period,$(=vSIT))))<$(=max(W_Period,4))"}>}WS_Qty)

My dimension is Country. If I use the above expression , if  I hard code then it is taking fine but when i pass variable it is taking maximum value of that field ignoring my country dimension. Please advice.

Country SIT

INDIA 16

INDONESIA 7

JAPAN 6

KOREA 6

MALAYSIA WEST 5

NEW ZEALAND 8

PHILIPPINES 5

TAIWAN 6

THAILAND 6

VIETNAM 7

Message was edited by: Ruchi Bagaria

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Maybe like

Market =sum( Aggr( If( Rank(Period) <= SIT and Rank(Period) > 4, Quantiy), Market,Period))
1650
INDIA500
INDONESIA1150

View solution in original post

5 Replies
sunny_talwar

Set analysis is evaluated once per chart. It will take just one value, like you have just discovered. You might need to use another approach to do this. Can you share a more comprehensive sample to be able to help you better

swuehl
MVP
MVP

That's how set analysis as well as dollar sign expansions work, they are evaluated once per chart, not per dimension line:

Evaluating "sets" in the context of a dimension

Anonymous
Not applicable
Author

Thanks for the quick response. Please find the sample attahced. In this example, India total should be 500 and indonesia total should be 1150 but my expressions showing wrong values. please guide.

Ruchi ! !

swuehl
MVP
MVP

Maybe like

Market =sum( Aggr( If( Rank(Period) <= SIT and Rank(Period) > 4, Quantiy), Market,Period))
1650
INDIA500
INDONESIA1150
Anonymous
Not applicable
Author

Thank you so much. I was so fretted about it. Such a neat solution!