Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
NZ_QV_Guy
Contributor
Contributor

Using Variables for Expressions

Stuck on this one for some time today, hoping some more brains can help figure it out.

 

For ease of example I have two variables:

"vFormula_1001" which looks like: Sum({<DateFilter,[GL Account Group]={'A*'}>} ActValue)

and "vFormula_1002" which looks like: Sum({<DateFilter,[GL Account Group]={'B*'}>} ActValue)

 

I then have a table chart with 1 Dimension: ValueList('Row1','Row2'), and 12 columns: "Fiscal Month 1", "Fiscal Month 2" … etc. through "Fiscal Month 12".

 

What I want to do is replace the "DateFilter" text portion of the variables with "FiscalMonth={'01'}", 02 … etc. through 12 and evaluate the resulting string as my expression.

 

So my chart expression for Fiscal Month 1 is: pick(RowNo(),Replace(vFormula_1001, 'DateFilter,', 'FiscYear={'&Chr(39)&'01'&Chr(39)&'}'),Replace(vFormula_1002, 'DateFilter,', 'FiscYear={'&Chr(39)&'01'&Chr(39)&'}')).

 

In this form the expression evaluates perfectly, displaying as a string. However as soon as I put a $() or $(=) around each pick option I get no results.

Reason I am doing this is to build some financial reports and I don't want to have to duplicate by 12 each line as a variable.

 

1 Reply
jaibau1993
Partner - Creator III
Partner - Creator III

Hi!

You only need two new parametriced variables. Please, check the attached file.

Bests,

Jaime.