Qlik Community

Ask a Question

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
April 22, 2PM EST: Learn about GeoOperations in Qlik Sense SaaS READ MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
upaliwije
Creator II
Creator II

Variable

Hi Friends

 

I have created a variable to be used in my expression but it does not work. Kindly help me to get it corrected

 

Screenshot_1.png

Screenshot_2.png

Labels (1)
1 Solution

Accepted Solutions
anushree1
Specialist II
Specialist II

please check the attached I added a new Expression called Using Variable New Expression in the chart using Variable  and removed equals from variable definition

View solution in original post

20 Replies
Shubham_Deshmukh
Specialist
Specialist

Hi @upaliwije,

1. It is not good practice to put such hard code values of month year

2. If you want so, no need to use variable for that

3. Try this

=count(DISTINCT(if(match(CHARGED_Month_Year,'Aug-2018','Sep-2018',,,,,),CLAIM_NO)))

upaliwije
Creator II
Creator II
Author

Thanks

Since I have to use this variable over & over again I thought of creating a variable

Shubham_Deshmukh
Specialist
Specialist

If it works for you, mark the answer as solution so that people can get quick idea
upaliwije
Creator II
Creator II
Author

What you suggest works. In fact my previous expression shown in my image also works fine . But What I  want to use the expression with a variable for the months mentioned. If you can pls help me with that. Thanks 

MindaugasBacius
Partner
Partner

Try modifying the expression like this:
Count(Distinct {<CHARGED_month_year = { '$( =$(vCM) )'} CLAIM_NO)

Shubham_Deshmukh
Specialist
Specialist


Hi,

First load you month-year data as it is fix,

dates:
LOAD * INLINE [
monthYear
Aug-18

Sep-18

Dec-18

];

monthYearCombo:
load Concat( chr(39) & monthYear& chr(39), ',') as monthYearCombo
Resident dates;

Let vStatus=monthYearCombo;

Now in expression use this,

=count(DISTINCT(if(WildMatch(CHANGED_Month_Year,'*$(vStatus)*'),CLAIM_NO)))

Shubham_Deshmukh
Specialist
Specialist

I updated ans little bit check this now.
anushree1
Specialist II
Specialist II

remove Charged_Month_Year from variable definition keep it as : ={'Aug-2018',.......}

upaliwije
Creator II
Creator II
Author

Thanks

Still it is not working