Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

Storing a Value of a Set analysis expression in a Variable

Hi Guys,

I am new to Qlik and struggling with storing  a set analysis expression's value in a variable.

I want to store below expression's value in a variable so that i can use that further for some calculations.

Min({< Data_Period = {'Weekly'},Formatted_Date = {'>$(=$(vSelectedWeek))'}>} Date,2)

The above expression works fine if i use it in a text box on a sheet tab. However, it is not working if i try to store its value in a variable and use that variable.

Set vW1 = Min({< Data_Period = {'Weekly'},Formatted_Date = {'>$(=$(vSelectedWeek))'}>} Date,2);


Here  vSelectedWeek  is being calculated as follows:


  Set vSelectedWeek = Date(Weekstart(Only(BaseData_Date)),'dd/MM/YYYY');


Please advise if i am doing anything wrong or is there any other way around to achieve the same?

Thanks in advance.

7 Replies

Re: Storing a Value of a Set analysis expression in a Variable

So $(vW1) in a text box isn't working? Do you have a equal sign before Min in the Variable Overview?

Not applicable

Re: Storing a Value of a Set analysis expression in a Variable

Yes, =$(vW1) is not working in text box.

Not applicable

Re: Storing a Value of a Set analysis expression in a Variable

If i write

=vW1

in a text box (to check if it is returning the correct value for vSelectedweek), It returns:

  Min({< Data_Period = {'Weekly'},Formatted_Date = {'>'}>} Date,2);

looks like it is not able to calculate the variable vSelectedWeek. dont know how can i make it return the correct value?

Re: Storing a Value of a Set analysis expression in a Variable

What about this:

=$(=vW1)

If it still doesn't work, would you be able to share a sample?

reddys310
Honored Contributor II

Re: Storing a Value of a Set analysis expression in a Variable

hi Aditya,

Making use of 2 equal to signs should solve your issue and works the same in both Qlikview and Sense.

Check this document for more deeper insight:

The Magic of Variables

Not applicable

Re: Storing a Value of a Set analysis expression in a Variable

Hi Sangram,

As per your suggestion, i tried below expression:

Set vW1 = = Min({< Data_Period = {'Weekly'},Formatted_Date = {'>$(=$(vSelectedWeek))'}>} Date,1);

and it is not working.

Not applicable

Re: Storing a Value of a Set analysis expression in a Variable

Hi Sunny, it is not working.

Community Browser