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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
katerinainfantino
Contributor
Contributor

Sum based on other criteria

Hi Qlik community!

I need to sum only if Brand is 1.  I'm using 2023 as CurYear and 12 as CurMonth.  Answer should be 3,250.  However, it is adding all 2023.  This is the formula I'm using:

katerinainfantino_1-1705442660210.png

katerinainfantino_0-1705442528845.png

Could you please tell me what I'm doing wrong? 

 

Labels (4)
1 Solution

Accepted Solutions
Chanty4u
MVP
MVP

Try this

sum({$<[Brand]={'1'}, Year={'$(CurYear)'}, Month={'$(CurMonth)'}>}qty)

 

View solution in original post

3 Replies
Vegar
MVP
MVP

Try separating all set modifiers with a comma similar to below. (I noticed that you did not do it for Brand in your example.

SUM({<Brand={1}, Date.autocalendar.Year={$(vCurYear)}, Field={'Value'}, etc...>}Quantity)

 

Please also take a look at your month variable and confirm that the value can be compared to the values in the month field you are using. In your text you write the value is 12, but in the image the month looks like a date value.

Chanty4u
MVP
MVP

Try this

sum({$<[Brand]={'1'}, Year={'$(CurYear)'}, Month={'$(CurMonth)'}>}qty)

 

katerinainfantino
Contributor
Contributor
Author

It worked!  Thank you!