Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
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 !

 

4 Replies
Highlighted

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
Highlighted
Contributor II
Contributor II

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?

 

 

 

Highlighted
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.

Highlighted

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.