Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
sumanta12
Creator II
Creator II

Set expression issue

TEST_INLINE:
LOAD * INLINE [
TOGGLE
M,
W
];

 

TAB:
LOAD * INLINE [
FLAG, DATE, VALUE, MONTH_YEAR
MONTHLY, 2022-01-01, 0, 202201
MONTHLY, 2022-02-01, 0, 202202
MONTHLY, 2022-03-01, 0, 202203
MONTHLY, 2022-04-01, 3000, 202204
MONTHLY, 2022-05-01, 4000, 202205
MONTHLY, 2022-06-01, 500, 202206
MONTHLY, 2022-07-01, 4200, 202207
MONTHLY, 2022-08-01, 6030, 202208
WEEKLY, 2022-01-01, 2000, 202201
WEEKLY, 2022-02-01, 2400, 202202
WEEKLY, 2022-03-01, 2200, 202203
WEEKLY, 2022-04-01, 2030, 202204
WEEKLY, 2022-05-01, 2000, 202205
WEEKLY, 2022-06-01, 6000, 202206
WEEKLY, 2022-07-01, 4200, 202207
WEEKLY, 2022-08-01, 6030, 202208
];

sumanta12_0-1661945424300.png

IF(GetFieldSelections(TOGGLE)='M',
Sum({<FLAG ={'MONTHLY'},MONTH_YEAR={">$(=MAX(MONTH_YEAR)-2)"}>}VALUE))

The expression is not filtering to only 2 month_year rather it is showing all the month_year with 0 values.

When I am not using If condition that time it is filtering properly.

 

 

1 Solution

Accepted Solutions
Or
MVP
MVP

This is behaving as I'd expect - with the If() statement, this is evaluated for every dimension value because the if() doesn't contain set analysis excluding any values. You could uncheck "Include zero values" to get around this, or re-write the formula:


Sum({<FLAG ={'MONTHLY'},MONTH_YEAR={">$(=MAX(MONTH_YEAR)-2)"}>}

IF(GetFieldSelections(TOGGLE)='M',VALUE))

View solution in original post

1 Reply
Or
MVP
MVP

This is behaving as I'd expect - with the If() statement, this is evaluated for every dimension value because the if() doesn't contain set analysis excluding any values. You could uncheck "Include zero values" to get around this, or re-write the formula:


Sum({<FLAG ={'MONTHLY'},MONTH_YEAR={">$(=MAX(MONTH_YEAR)-2)"}>}

IF(GetFieldSelections(TOGGLE)='M',VALUE))