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: 
curiousfellow
Specialist
Specialist

use variable as result of another variable in set analysis

I have a variable as a result of another variable.

In a textbox the correct value of this variable is displayed

Now I want to use this variable in set analysis.

I think I tried every possible syntax but nothing works.

When I use a number instead of this variable in set analysis I get the correct results too

What I think the syntax should be =

count(distinct {<year= {'$(vYear)}>} employees)

or

count(distinct {<year= {'$(=vYear)'}>} employees)

double quotes didn't help

4 Replies
sunny_talwar

How do you define vYear? May be you need a dollar sign expansion for your variable also?

Count(Distinct {<year= {"$(=$(vYear))"}>} employees)

curiousfellow
Specialist
Specialist
Author

I will try to explain something more.

I have to listboxes , one with the dimension year

and one with the dimension year_to_compare_with

When i select year , then  all periods should be selected where the enddate of the period < today()

Every period has a number, a period is a kind of a quarter but begin and enddate don't match calendar quarters. the number of a period of a period is calculated by : year*4+quarter

This period number is a field in every record.

To store the  periodnumber in a variable  called v_periodnumber  I use a Mastercalendar table with next expression :

=max(distinct {1<MasterCalander.period_enddate = {"=max(MasterCalander.period_enddate_Educator) < vDdate_today"}>} periodnumber)

To get the periodnumber where to compare with I use another variable v_periodnumer_to_compare with the expression :

=v_periodnumber –((year-year_to_compare_with-year)*4)

Both variables show correct values in a textbox

But when I use the expression 

count( distinct {1<periodnumber= {=$(v_period_to_compare)}>}employees)

I get 0 as a result




Your solution didn't give a good result neither

curiousfellow
Specialist
Specialist
Author

problem solved, allthough I don't know what is different from the expression I used before

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Please mark this discussion as answered.

answered‌

resolved‌


talk is cheap, supply exceeds demand