Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

aggr( help with returning a dimension instead of expression

=max(aggr(count([t1Sales_Name and Cluster code]),[t1Sales_Name and Cluster code]))

This is my code (which doesn't work...

Table looks like so

[t1Sales_Name and Cluster code]              /      Sales

Test                                                         /      1000

Test1                                                       /      2000

I would like my aggr function to work out what [t1Sales_Name and Cluster code] has the highest sales value.

Expected output would be

Test1

Let me know if I've not been clear enough,

james.

1 Solution

Accepted Solutions
Gysbert_Wassenaar

If your sales field is named Sales try this:

=FirstSortedValue([t1Sales_Name and Cluster code], -aggr(sum(Sales),[t1Sales_Name and Cluster code]))


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar

If your sales field is named Sales try this:

=FirstSortedValue([t1Sales_Name and Cluster code], -aggr(sum(Sales),[t1Sales_Name and Cluster code]))


talk is cheap, supply exceeds demand
Not applicable
Author

Hey I know this is very greedy, but I have another problem. Could you perhaps write the aggr for me?

Imagine this:

[t1Sales_Name and Cluster code]    --     Count([t1Sales_Name and Cluster code])

Test                                             --          2

Test 1                                             --   1

would it be the same as your given example above?