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

Rank Sum issue

Hello ,

The expression below works fine when the "Amount" field is a positive number looking for the solution for the reverse when it's negative.Tried to negate the sum function but it not working.

sum({<Name = {"=rank(sum(Amount))<=$(Top)"}>} Amount)

where $(Top) is an input box variable

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

Check enclosed file

View solution in original post

13 Replies
MK_QSL
MVP
MVP

What you want when the amount is negative values? May be

sum({<Name = {"=rank(sum(If(Amount<0,-Amount,Amount)))<=$(Top)"}>} Amount)

or

sum({<Name = {"=rank(sum(If(Amount<0,-Amount,Amount)))<=$(Top)"}>} IF(Amount<0,-Amount,Amount))

Anonymous
Not applicable
Author

Those didn't work either.

Sorry! Let me add some more clarity to my question. This amount is always negative in this instance, and so when I input a number in the input box say 5 the expression I required is to calculate the top amount by the Name(dimension).The expression works fine with the sales fieldname which is always a positive.

Thanks.

MK_QSL
MVP
MVP

Provide sample data in excel file along with required output... Thanks

Anonymous
Not applicable
Author

MK_QSL
MVP
MVP

Create a Straight Table

Dimension

Name

Expression

SUM({<Name = {"=Rank(SUM(Amount),4)<=5"}>}Amount)

or

SUM({<Name = {"=Rank(SUM(Amount),4)<=$(vTop)"}>}Amount)

Anonymous
Not applicable
Author

That didnt work either.I have already created already a straight table and used the dimension limits to make it work. I show only the smallest  and the value is the variable $(Top) which a dynamic for user input.

Now I want to replicate the this in an expression and display in a Text box.

MK_QSL
MVP
MVP

SUM({<Name = {"=Rank(SUM(Amount),4)<=$(vTop)"}>}Amount)

Anonymous
Not applicable
Author

@Manish Kachia

Quite unfortunate it's not working

MK_QSL
MVP
MVP

What you want to show in List BOX? Total of $(vTOP) ?