Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Set Modifiers Max year ,Prev Year with selections

Hello all,

I have a line chart where I want to show the trendline between the max year selected and the previous year of the sales for the products A,B,C with the following expression:

sum({$*<[Product]={'A','B','C'},[Year]={$(=Max(Year])),$(=Max([Year])-1)}>} sales)

My problem is that if I select product A and year=2017. I want only to see the trendline for that specific product that's why I've included $* before the condition but at the same time, with this set modifier , the max year selected (2017) appears but not the previous year (2016).

Could you please give me any advice about how I could show the product selected and the max year selected + previous year?

Thanks in advance

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Try

sum({$<[Product] *= {'A','B','C'},[Year]={$(=Max(Year])),$(=Max([Year])-1)}>} sales)

so that the intersection applies to only the Product field modifier.

View solution in original post

5 Replies
its_anandrjs

Try with and make changes in youri expresssion


//The expression works for max year to previous year

sum({$<[Product]={'A','B','C'}, [Year] = { ">=$(=Max(Year])-1)  <=$(=Max([Year]))" }>} sales)

swuehl
MVP
MVP

Try

sum({$<[Product] *= {'A','B','C'},[Year]={$(=Max(Year])),$(=Max([Year])-1)}>} sales)

so that the intersection applies to only the Product field modifier.

its_anandrjs

Earlier was a typo


Try with and make changes in your expression


//The expression works for max year to previous year

sum({$<[Product] *= {'A','B','C'}, [Year] = { ">=$(=Max(Year)-1)  <=$(=Max(Year))" }>} sales)

Anonymous
Not applicable
Author

Thanks as always!! It worked

Anonymous
Not applicable
Author

Thanks a lot! what I needed as Stefan and you pointed out was the * before *= {'A','B','C'}.

Thanks!