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: 
Anonymous
Not applicable

multiple varible inside set analysis


Can we pass multiple variable inside set analysis? i am passing 4 variables, but does not work

21 Replies
qlikmsg4u
Specialist
Specialist

the expression you posted is incorrect because

in your variable vPrevmnth1=month(AddMonths(Today(),-1)) you will get month, how can you comapre year field with month?

Year={'$(vPrevmnth1)'}

so it should be Year={'$(vPrevmnth2)'}

and same for Month also

gautik92
Specialist III
Specialist III

avg({$<Environment={'$(vEnvironment)'},Component={'$(vComponent)'},Year={"$yearstart(vPrevmnth1)"},Month={"$WeekStart(vPrevmnth2)"}>} usage)

Anonymous
Not applicable
Author

ya correct, but it does not work

qlikmsg4u
Specialist
Specialist

is it ok to post the sample app?

Alvaro_Palacios
Support
Support

Hey Rajashmita,

When creating these two variables

vPrevmnth1

vPrevmnth2

make sure you add the equal sign '=' before the expressions so these are evaluated and can be correctly passed to the set analysis expression:

=month(AddMonths(Today(),-1))

=year(Today())


Alvaro P.

Anonymous
Not applicable
Author

Hi Rajashmita,

Try as below

=avg({$<Environment={'$(vEnvironment)'},Component={'$(vComponent)'},Year={'$(vPrevmnth1)'},Month={'$(vPrevmnth2)'}>} usage)

where vPrevmnth1 = year(Today())
vPrevmnth2 = month(AddMonths(Today(),-1))

Regards

Neetha

Anonymous
Not applicable
Author

Ya it is with equal only

Anonymous
Not applicable
Author

hi neetha, thanks tried same already but doesnt work

Anonymous
Not applicable
Author

ll try to upload the sample, but just wanted to tel that month(AddMonths(Today(),-1)) gives Jul as data and with above expression it does not show anything, and dimention as week,data,hour and minute

qlikmsg4u
Specialist
Specialist

what is your month format?

try to give static values in set expression rather than variable values and see what happens.

avg({$<Environment={'$(vEnvironment)'},Component={'$(vComponent)'},Year={2015},Month={7}>} usage)