Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem using variables

Hi

I have declared the following variable

  set vLateMTD = Sum({$<_LATE_MONTH_ID = {"$(=Max([_LATE_MONTH_ID]))" }>} LATE_ORDER_COUNT);

When I try this in a chart calculation its not returning any values.

Yet when I set the expression to be Sum({$<_LATE_MONTH_ID = {"$(=Max([_LATE_MONTH_ID]))" }>} LATE_ORDER_COUNT) its returning data.

I also tried (and this didn't work either)

  set vLateMTD = Sum({$<_LATE_MONTH_ID = {"=$(=Max([_LATE_MONTH_ID]))" }>} LATE_ORDER_COUNT);


Thanks


Andy

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Try this:

LET vLateMTD = 'Sum({$<_LATE_MONTH_ID = {"$' & '(=Max([_LATE_MONTH_ID]))" }>} LATE_ORDER_COUNT)';


talk is cheap, supply exceeds demand

View solution in original post

4 Replies
Gysbert_Wassenaar

Try this:

LET vLateMTD = 'Sum({$<_LATE_MONTH_ID = {"$' & '(=Max([_LATE_MONTH_ID]))" }>} LATE_ORDER_COUNT)';


talk is cheap, supply exceeds demand
marcus_sommer

Another method would be: Re: Setting a variable in script... whereby if you want to declare many variables on this way an outside-storing of them might be more practically: Storing variables outside of QlikView - The Qlik Fix! The Qlik Fix!

- Marcus

Not applicable
Author

That worked thanks.

Not applicable
Author

Thanks for that, I have got it working using this method as well