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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
bkn
Contributor II
Contributor II

Variable inside Set Analysis

SET vMonth2019 = 2019

SET vStatus = IF($(vMonth2019 )='0','N','Y');

SUM({$<[Contion1]={'True'}, vStatus ={'Y'}"}>}$(vTotal)))      // Need to use vStatus Variable inside expression.

 

Thanks in Advance !

 

Labels (1)
4 Replies
rubenmarin

Hi, I suppose you wnat to use the result of vStatus expression, for that it will need an extra '=':
SET vStatus = =IF($(vMonth2019 )='0','N','Y');

You can use it in set analysis as vMonth2019 is used in vStatus:
SUM({$<[Contion1]={'True'}, vStatus={'$(vStatus)'}"}>}$(vTotal))) // vStatus should be a field where you use the value of the vStatus variable
bkn
Contributor II
Contributor II
Author

SET vStatus = IF($(vMonth2019 )='0','N','Y');

SUM({$<[Contion1]={'True'}, vStatus={'$(vStatus)'}}>}$(vTotal)))

//Tried as you said, but its giving all the value vMonth2019  as 0.

Any other solution?

 

 

 

qv_testing
Specialist II
Specialist II

 

SUM({$<[Contion1]={'True'}, vStatus ={'Y'}"}>}$(vTotal))) which i have highlighted in RED that should be field.

You can write in script.

IF(Year=0, 'N', 'Y') as Field;  or  IF(Len(Year)=0, 'N', 'Y') as Field ;  or  IF(Len(Trim(Year))=0, 'N', 'Y') as Field ;

If you provide sample data that would be great, easy to understand.

rubenmarin

In your example vMonth2019 has a fixed value of 2019:
SET vMonth2019 = 2019

BTW, your vStatus only hsa one '=', as I said you need 2.

My answer only explains how to use a variable inside set analysis, wich is the only question you have in your post, for a solution you need to explain what are you trying to do, and it will be easier for both of us if you upload a sample.