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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Variable Issue in Set Analysis

Hi guys,

I am very new to QlikView and I am trying to work out how to use a variable in a set analysis expression.

I have tried doing it, but it is not giving me the right results. I believe I might be doing something wrong when I reference the variable in the set analysis.

Please can someone kindly help me write out a simple set analysis expression using one variable and two fields.

Let's assume the variable is called vLastMonth and the field name is called CurrentDate.



Thanks in advance

24 Replies
Not applicable
Author

okay, Thank you for the Information Toni Kautto! I changed....
But that didnt solve my Problem ....

Not applicable
Author

@ Toni,  after changing the date format... I can't run.. because I am using in my script.. other things.. therefore I need the convert into number....

ToniKautto
Employee
Employee

Ah, of course if you use it elsewhere you need to change everywhere if you change.

I am thinking that  maybe you should move your issues to a new thread, as it is not really related to the original topic in this thread. In the new thread please post you application to enable a better understanding of your trouble.

Not applicable
Author

okay, I will thank you!!!!

Not applicable
Author

Hi jenni441,

from what i read in the post and understood,

you want the Sales to be displayed of a particular day, that day being which the user selects.... or if there is no selection, the current date...

liron's answer would have definitely worked for you.

what you need to understand is that the current date will be the maximum date in you list of dates loaded.

so if there is no selection the current date(max date) needs to be used, and wen there is a selection.. that date needs to be used.

Also, how max() function works is it picks the maximum value from the list of "possible" values... it means that when there is no date selected all dates are possible values.. and if one or few dates are selected, only those selected dates are in the list of "possible values"..

so you just need to select the maximum date.

so in you expression you just need to write a set analysis expression to poick the maximum date.

i believe the following would do that for you.

sum({<Date={"$(=max(Date))"}>} Sales)

where Date is your date field.. (replace with your actual  date_field_name)

Cheers,
Abhinava