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

Aggregation over sub dimensions

  1. Greetings.

I have a feeling the answer involves the Aggr() function; however, as yet I can not get it to work.

I have a table similar to the example below

Order #SKULead time (days)Rank
1693391112703

169339

2231

111

6
16933934511418

169339

35661669

169339

8582895

178040

1112581
1780402231714
1711931112602
17811111121217

I can perform ranking and averaging etc on the table when I have one SKU selected, but when the selection is removed the ranking and average refers to all data displayed in that column (as shown above).

What I want to achieve is have an unfiltered table but show the ranking etc per SKU.

For example:

Order #SKULead time (days)Rank
1693391112703

169339

2231

111

2
16933934511411

169339

35661661

169339

8582891

178040

1112581
1780402231711
1711931112602
17811111121214

Please can anyone help?

1 Solution

Accepted Solutions
anbu1984
Master III
Master III

Check this qvw

=Alt(aggr(rank(-[Lead time (days)]),SKU,[Lead time (days)]),Above(aggr(rank(-[Lead time (days)]),SKU,[Lead time (days)])))

View solution in original post

12 Replies
anbu1984
Master III
Master III

Aggr(Rank([Lead time]),SKU)

Not applicable
Author

Hii,

Please use this expression for solution:-

=aggr(rank([Lead time (days)]),SKU,[Order #])

And also find the attached QVW .

Not applicable
Author

Hi

Firstly - Thanks to everybody for their advice

I have attached an example and for unknown reasons your suggestion (which works in your example) acts differently in mine???

They are basically the same but I am unable to spot what's wrong...

Not applicable
Author

Hi

Thank you for your advice.  I have now attached an example in reply to Prince Anand.  This didn't quite solve my problem but I think it is a step in the right direction.

Not applicable
Author

The Only difference is that It is giving result in Descending Order but

I think you want the result in Ascending Order.

Thanks & Regards

Prince Anand

Not applicable
Author

Please check the expression for taht solution:-


=aggr(rank(-[Lead time (days)]),SKU,[Order #])

I think you want the result like this:-

Not applicable
Author

The difference I am talking about is that the table on the left has more results visible.  For example, using this expression I am losing all results for SKU 3487 and only getting partial results for 1123...

I have been trying to play with the aggr() function but not arrived at the desired result.

Thanks again

Oli

Not applicable
Author

I tried this

=aggr(rank(total [Lead time (days)],0,1),[Lead time (days)], SKU,[Order #])

which shows all the results but I am back to the rank being for the whole table not per SKU/Lead time.

Also - when I removed the total from the rank formula I get all lines as rank 1.

anbu1984
Master III
Master III

Check this qvw

=Alt(aggr(rank(-[Lead time (days)]),SKU,[Lead time (days)]),Above(aggr(rank(-[Lead time (days)]),SKU,[Lead time (days)])))