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: 
Not applicable

Accumulate sum based on the rank

Hi,

I have data similar to

CityPopuationRank
NY5001
SJ2004
SFO3003
LA4002

The user must select one of the city. I want the accumulated sum (in a text Box)for all the city where exist a same and higher rank.

For example, If the user select SFO, In the text box the final answer should be 1200(NY:500+ LA:400+SFO:300).

Thanks

7 Replies
Not applicable
Author

Try below expression

=

sum({<City=,Rank={"<=$(=max(Rank))"}>}Population)

Not applicable
Author

hi

try it

=rangesum(above(sum(population), 0 , RowNo()))

hope this helps you

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Put this expression in a text box if Rank is a field:

=sum({<City=,Rank={">=$(=only(Rank))"} >} Popuation)

If Rank is an expression based on Popuation  then you could use:

=sum({<City=,Popuation={">=$(=only(Popuation))"} >} Popuation)

If Popuation should be Population change the expressions accordingly.


talk is cheap, supply exceeds demand
Not applicable
Author

hi Gysbert Wassenaa sir

display correct output.

thanks

Not applicable
Author

Hi Gysbert,

Thank you very much for your kind reply.

It is working fine, for a single line of data. But if there is case, where

CityPopuation
NY500
SJ200
SFO300
LA400
SFO100

Could you update the formula you have given earlier.

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Which value of the two should be used?

max?

=sum({<City=,Popuation={">=$(=max(Popuation))"} >} Popuation)

min?

=sum({<City=,Popuation={">=$(=min(Popuation))"} >} Popuation)

average?

=sum({<City=,Popuation={">=$(=avg(Popuation))"} >} Popuation)


sum?

=sum({<City=,Popuation={">=$(=sum(Popuation))"} >} Popuation)



talk is cheap, supply exceeds demand
Not applicable
Author

Thank you so much for your quick reply.

There must be at least one selection. For example,We need to select SFO.

We need to find the sum of the population for SFO. Then we can give compare the SFO population with other cities population.

It shoud be similar to the last one you indicated "

sum?

=sum({<City=,Popuation={">=$(=sum(Popuation))"} >} Popuation)"

Currently, It is not working, as disired.

Thanks