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: 
yanivvl0
Creator III
Creator III

How to sum the last value for all the members - before the selected year WITH Filter?

hi everybody ,

i had a previos question - see https://community.qlik.com/thread/207054?sr=inbox

responded beautifully by Gysbert Wassenaar , 

The thing is that there is a need to do further screening of the formula that produces the desired result: - after the calculation exists - we have to find occurrences of a particular status (say 90) only summarize them. You can see highlighted in yellow which from them - to summarize only those with a red X, Many thanks.

max prev year 2015 _ 90.PNG

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Why should the fifth row with P_NO_1 10253 be excluded?


talk is cheap, supply exceeds demand

View solution in original post

12 Replies
sunny_talwar

Are you trying to do this in a text box object or the table you need another column?

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Does this give you the result you want?

=sum({<P_NO_1=P({<STATUS_1={90}, YEAR_STATUS_DATE_1={'<$(=Max(YEAR_STATUS_DATE_1))'}>}P_NO_1), YEAR_STATUS_DATE_1={'<$(=Max(YEAR_STATUS_DATE_1))'}>} aggr(FirstSortedValue({<YEAR_STATUS_DATE_1={'<$(=Max(YEAR_STATUS_DATE_1))'}>}UnitsForMetsai, -YEAR_STATUS_DATE_1),P_NO_1))


talk is cheap, supply exceeds demand
sunny_talwar

Do you mean STATUS_1?

=sum({<P_NO_1=P({<STATUS_1={90}>}P_NO_1), YEAR_STATUS_DATE_1={'<$(=Max(YEAR_STATUS_DATE_1))'}>} aggr(FirstSortedValue({<YEAR_STATUS_DATE_1={'<$(=Max(YEAR_STATUS_DATE_1))'}>}UnitsForMetsai, -YEAR_STATUS_DATE_1),P_NO_1))

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Yeah, that one


talk is cheap, supply exceeds demand
yanivvl0
Creator III
Creator III
Author

hi Sunny - text box pls.

yanivvl0
Creator III
Creator III
Author

yes you are correct .

sunny_talwar

So is Gysbert's solution working?

sunny_talwar

If you are looking for STATUS_1 = 90 and not P_NO_1 where STATUS_1 = 90, then may be this:

=Sum({<STATUS_1 = {90}, YEAR_STATUS_DATE_1={'<$(=Max(YEAR_STATUS_DATE_1))'}>} aggr(FirstSortedValue({<YEAR_STATUS_DATE_1={'<$(=Max(YEAR_STATUS_DATE_1))'}>}UnitsForMetsai, -YEAR_STATUS_DATE_1),P_NO_1))

yanivvl0
Creator III
Creator III
Author

hi Gysbert , something is wrong ,

i attach the qvw document with a selection that i made , the result supose to be 1021 as you see in the image but we get 1447 :

max prev year 2015 _ 90 v2.PNG