# Qlik Sense App Development

Not applicable

## How to sort items based on spend and i need figures based on savings in the pie-chart

How to sort items based on spend and i need figures based on savings in the pie-chart.I want to sort only top 3 items and  this is my table

 Item ID Spend Savings 11 120 12 12 140 14 13 90 40 14 30 16 15 180 18 16 60 30 17 110 17 18 40 8 19 130 25 20 160 10

So pie-chart answer should be like this                                          and NOT like this

Item ID      Savings                                                                 Item ID      Savings

15                18                                                                          13             40

20                10                                                                          16             30

12                14                                                                          19             25

Regards

Nagarjuna

1 Solution

Accepted Solutions
MVP

## Re: How to sort items based on spend and i need figures based on savings in the pie-chart

Seems to be working for me

31 Replies
MVP

## Re: How to sort items based on spend and i need figures based on savings in the pie-chart

How do you get the top 3 to be 15, 20, 12?

MVP

## Re: How to sort items based on spend and i need figures based on savings in the pie-chart

I think based on the Spend column

MVP

## Re: How to sort items based on spend and i need figures based on savings in the pie-chart

May be this:

If(Rank(Sum(Spend)) < 4, Sum(Savings))

MVP

## Re: How to sort items based on spend and i need figures based on savings in the pie-chart

or

Sum({<[Item ID] = {"=Rank(Sum(Spend)) < 4"}>}Savings)

Not applicable

## Re: How to sort items based on spend and i need figures based on savings in the pie-chart

Thanks for your assistance, but both are not working.

Not applicable

## Re: How to sort items based on spend and i need figures based on savings in the pie-chart

You have any other formula?

MVP

## Re: How to sort items based on spend and i need figures based on savings in the pie-chart

Seems to be working for me

Not applicable

## Re: How to sort items based on spend and i need figures based on savings in the pie-chart

I have multiple spend amounts and multiple saving amounts for the same item, sorted top 3 items using table based on spend, so all spends and savings came  to one one number for one item, then i tried the above  formula but it is showing based on top 3 savings only. Is this because of multiple spends and savings?

MVP

## Re: How to sort items based on spend and i need figures based on savings in the pie-chart

I don't think it should be a problem, but if you are able to share a sample where you see an issue, we can dig deeper into it