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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

List of years to pass through variables dynamically

My concerns is  i have to pass all the years through varibles dynamically, in below i have hard coded years but tomrrow it will add the two More years like 2018 Or 2019 so that i have to  pass the years dynamically through variables. 

(RPT_YR = 2012 OR RPT_YR = 2013 OR RPT_YR = 2014 OR RPT_YR = 2015 OR RPT_YR = 2016 OR RPT_YR = 2017) AND
(COMP_DESC = 'COKY' OR COMP_DESC = 'MDP' OR COMP_DESC = 'MOCHA' )

I have set the two variables one for years and another for company list. but it is not working to see in the below script

 

(RPT_YR = $(Year) AND COMP_DESC = $(CompanyName))

Please let me if i am missing in the above expression or adding

10 Replies
bruno_m_santos
Partner - Creator
Partner - Creator

Try

SeT Year= 2012 or 2013 or 2014;

Set CompanyName='COKY' OR 'MDP'  or  'MOCHA' ;

Thanks

Not applicable
Author


Hi Bruno,

I have to pass the all the years through variables. in case two more years or Two more companies are added in feature. Again i have to add in the expression. So that we need to pass the all the years through variables.

if i am passing the below expression it is working but  i have to pass the all the years through variables

 

(

RPT_YR = 2012 OR RPT_YR = 2013 OR RPT_YR = 2014 OR RPT_YR = 2015 OR RPT_YR = 2016 OR RPT_YR = 2017) AND
(
COMP_DESC = 'COKY' OR COMP_DESC = 'MDP' OR COMP_DESC = 'MOCHA' )

davidrobles
Partner - Contributor III
Partner - Contributor III

Set Analysis.

{<RPT_YR ={'*'},COMP_DESC ={'COKY','MDP','MOCHA'}>}

bruno_m_santos
Partner - Creator
Partner - Creator

You must define the variables first 'Year' and 'CompanyName'.

You are using the expression in script?

You can use expression    wildmatch( Year, $(Year)) to obtain the same.

Not applicable
Author

Hi David,

 

{<RPT_YR ={'*'},COMP_DESC = {'COKY','MDP','MOCHA'}>} this expression is showing error like (Garbage after expression "=")  can you please let us know what is the issue on this expression.

Or Can please let us know who can we create the variables for RPT_YR and COMP_DESC columns

davidrobles
Partner - Contributor III
Partner - Contributor III

it´s a expression  Sum,Count....

ej.

sum({<RPT_YR ={'*'},COMP_DESC = {'COKY','MDP','MOCHA'}>} Value)

Not applicable
Author

Set Year = RPT_YR

Set CompanyName = COMP_DESC

to see in the above i have assigned all the years in Year variable and All the compnies are assigned into Company Variable. so Can You please guide me who can we build the set analysis for these two variables

davidrobles
Partner - Contributor III
Partner - Contributor III

In variable:

Year=

=Concat(Distinct [RPT_YR] ,'","')


in expression


Sum({<[RPT_YR]={“$(Year)”}>}Value)



Not applicable
Author

  Still I am not getting solution  on this report. What i am expecting if we cannot select any year from list box then cannot see any data in the report that's why we are adding expression to calcualted Condition on table box properties and  in Error message to add a message like to select a at least one year and company in the list box.

the below expression is working properly but in case any year is adding or company is adding in feature we have to add manually so that i am planing to pass all the years through variables

Please let me know how can we pass all the below year and company list through variable

(RPT_YR = 2012 OR RPT_YR = 2013 OR RPT_YR = 2014 OR RPT_YR = 2015 OR RPT_YR = 2016 OR RPT_YR = 2017) AND (COMP_DESC = 'COKY' OR COMP_DESC = 'MDP' OR COMP_DESC = 'MOCHA' )