Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
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