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: 
Not applicable

help: set analysis inside a variable

Hi,

expression box:

vF1Type -  'A','B','C','D'

vF2Type - 'Value1','Value2'

I have this expression:

(Sum( {<Field1={$(vF1Type)},Field2={$(vF2Type)}>} Sales * [Transaction Quantity])/1000000)

/+ (Sum({<Field1={$(vF1Type)},Field2={'Miscellaneous receipt'},Field3={'OUTS'}>} Sales * [Transaction Quantity])/1000000)

I stored this inside a variable but when i call the variable in the expression of a pivot table it doesnt give me the correct value.

What did i do wrong??

5 Replies
Not applicable
Author

i want this formula to generate values by quarter

qlikviewajeet
Contributor III
Contributor III

can u plz share your document.

Not applicable
Author

up

varunpbhandary
Partner - Contributor III
Partner - Contributor III

Hi Mars,

              You Cannot Use a Variable Directly inside the Value field of set analysis, What you can do is Build the expression as a variable and the value you want to put in set analysis as another variable and in the expressions tab use the final expression's variable.

for eg.

MaxCurrDate ---> max(CurrDate)

Expression ---> 'sum({$<CurrDate = {"'&MaxCurrDate&'"},Metric_Name={USD}>} [INR/1 Unit])'

then use the Expression's variable in expressions tab

Not applicable
Author

Mars,

I think your single-quotes are messing you up.

Try this instead:

Variables:

  • vF1Type = A,B,C,D <-- Notice, no quotes. None.
  • vF2Type = Value1,Value2

That might work right away. If not, try this:

Expression:

(Sum( {<Field1={'$(vF1Type)'},Field2={'$(vF2Type)'}>} Sales * [Transaction Quantity])/1000000)

/+ (Sum({<Field1={'$(vF1Type)'},Field2={'Miscellaneous receipt'},Field3={'OUTS'}>} Sales * [Transaction Quantity])/1000000)