Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Static Calculation with Variables

Hi all,

This one is kind of weird and I think the answer lies in knowledge of set analysis, which I do not have.

I have  2 dates and counts for each of those dates (I've named them max and min, but they are max(date) and max(date,2)). I set the counts for each of these into a variable;

vmaxDate :  =count({1<Date1 = {"$(=Max(Date1))"}>} stuff)

vminDate : =count({1<Date1 = {"$(=Max(Date1,2))"}>} stuff)

In my qlikview I have a text box with a convoluted expression:

=if(vmaxDate>vminDate, num(((vmaxDate-vminDate)/vmaxDate)*100, '#.##') & '%', num(((vminDate-vmaxDate)/vminDate)*-100, '#.##') & '%')

What I would like is when a date is selected (I have a listbox up) the expression in the textbox and subsequently the variables only still looks at the 2 maximum dates. In terms of the expression above, if I select any date, the function returns 100.00% and I want it to stay at the -60.00% it is currently.

note: I know there are alternative methods, such a detached chart etc. But I'm more interested in the context of these expressions and whether it's possible to write it up.

Thanks!

1 Solution

Accepted Solutions
sunny_talwar

Change your variables to this

vmaxDate : =count({1<Date1 = {"$(=Max({1}Date1))"}>} stuff)

vminDate : =count({1<Date1 = {"$(=Max({1}Date1,2))"}>} stuff)

View solution in original post

1 Reply
sunny_talwar

Change your variables to this

vmaxDate : =count({1<Date1 = {"$(=Max({1}Date1))"}>} stuff)

vminDate : =count({1<Date1 = {"$(=Max({1}Date1,2))"}>} stuff)