Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Variables in Set Analysis

Hi

My expression

Sum({$<Debug={'Budget'}, MonthSort = {'<=3'}>} If(AC2='70', BalanceLC))

works like a charm, summing up all values where the month is smaller than 3. Now I would like to replace the 3 with a variable, but I can't get it to work.

In the load script I have defined

LET vPeriods = 3;

Now when I try to replace the 3 with vPeriods it doesn't show any values. How can I use the variable in this expression?

Using CTRL+ALT+V shows that the variable exists and has the proper value:

I have tried:

Sum({$<Debug={'Budget'}, MonthSort = {'<=vPeriods'}>} If(AC2='70', BalanceLC)) = All values below limit

Sum({$<Debug={'Budget'}, MonthSort = {'<='&$(vPeriods)}>} If(AC2='70', BalanceLC)) = No data to display

Sum({$<Debug={'Budget'}, MonthSort = {'<='$(vPeriods)}>} If(AC2='70', BalanceLC)) = No data to display

Sum({$<Debug={'Budget'}, MonthSort = {$('<='&vPeriods)}>} If(AC2='70', BalanceLC)) = All values below limit

Sum({$<Debug={'Budget'}, MonthSort = {"<=vPeriods"}>} If(AC2='70', BalanceLC)) = All values below limit

What am I doing wrong?

The following is used to create the field MonthSort (cos our Fiscal Year starts in April):

LOAD * INLINE

[

MonthName, MonthSort, FMonth

APR, 1, 01

MAY, 2, 02

JUN, 3, 03

JUL, 4, 04

AUG, 5, 05

SEP, 6, 06

OCT, 7, 07

NOV, 8, 08

DEC, 9, 09

JAN, 10, 10

FEB, 11, 11

MAR, 12, 12

];

5 Replies
MK_QSL
MVP
MVP

Instead this, better if you can provide some sample data... easy to work and answer

sasikanth
Master
Master

HI

Try some thing like

Sum({$<Debug={'Budget'}, MonthSort = {'<$(= vPeriods)'}>} If(AC2='70', BalanceLC)

noman212
Creator III
Creator III

Not applicable
Author

Sasikanth_Narne

Thanks, this got me on the right track.

Sum({$<Debug={'Budget'}, MonthSort = {'<=$(=vPeriods)>'}>} If(AC2='70', BalanceLC))

seems to do the trick

sasikanth
Master
Master

u r welcome