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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

variable ?

Hi All,

Can anybody tell me how to use more than one variable in set expression?

I have a variable => Vperiod  ->  =getfieldselection(PERIOD)

And I want to use it in expression  while they are more than one period in Vperiod :  (1,2,3,4,5,6,7,...)

expression is   =sum ( {$(=PERIOD=??????

Thanks

1 Solution

Accepted Solutions
cesaraccardi
Specialist
Specialist

Yes, thats exaclty what I suggested... using the variable without '

Edit: No problem, Mayil.

View solution in original post

9 Replies
cesaraccardi
Specialist
Specialist

Hi,

You can use like this: sum({$<PERIOD={$(Vperiod)}>} Values)

Regards,

Cesar

Not applicable
Author

Thanks for reply,

It's good when you have one variable but withmore than one not working...

like 1,2,3,4,...

Any more idea?

cesaraccardi
Specialist
Specialist

I dont know if I understand... You have one variable with multiple values or more than one variable with multiple values?

Not applicable
Author

Here is the case:

I have period you which might be a single selection or multiple seceltion.

so if I select ie: period 1 , my getfiledselection returns 1 and in the set analysis it works, but if I select 1 & 2  in getfieldselection it returns 1,2 and in set analysis it goes crazy because it does not  work with 1,2 .

Is it clear?

Thanks

cesaraccardi
Specialist
Specialist

Ok... please notice that I put the variable inside the set without the ' around it. And this works if you define your variable with =GetFieldSelections(Period) otherwise the entire set of values will be treated as a single value and the expression wont work.

MayilVahanan

Hi

     Check this,

    

     Edit:

    

     Cesar Accardi Jr suggestion work.. Sorry Cesar Accardi Jr, i didn't see your post..

     Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
cesaraccardi
Specialist
Specialist

Yes, thats exaclty what I suggested... using the variable without '

Edit: No problem, Mayil.

Not applicable
Author

Thanks Cesar,

Can you please tell me how to add "only" to this function?

cesaraccardi
Specialist
Specialist

Sure, using the function only:

sum({$<PERIOD={'$(=Only(Period))'}>} Values)

Note that this function will works if you have only 1 possible value for Period.