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 max function

Hi guys

I am wating to find the max valueof sales for a particular company.

Have tried this but not working.

=if([Total Sales]=max(Aggr([Total Sales],[Company Name])),'Y', 'N')

1 Solution

Accepted Solutions
Not applicable
Author

if you have a straight table with two dimensions:

Company,

[Total Sales]

then expression you are looking for is:

if([Total Sales]=aggr(nodistinct max([Total Sales]),Company),'Y','N')

Best

Karol

View solution in original post

5 Replies
Gysbert_Wassenaar

What are you trying to do? Doesn't a straight chart with Company Name as dimenions and max([Total Sales]) as expression give you the maximum total sales for the companies?


talk is cheap, supply exceeds demand
Not applicable
Author

Apologies- I should have been more clear.

I have :

Company               Total Sales

Company A               20

Company A               30

Company A               40

Company B               10

Company B                10

Company C               32

I want the table to only show me the highest values for each company.

My idea was to create another dimension which would flag the highest value with a 'Y'.

Is there a better way to go about this?

Not applicable
Author

if you have a straight table with two dimensions:

Company,

[Total Sales]

then expression you are looking for is:

if([Total Sales]=aggr(nodistinct max([Total Sales]),Company),'Y','N')

Best

Karol

Not applicable
Author

This is brilliant- works perfectly. Thank you so much.

No that I have a column flagging the highest value - how can I have my table only showing rows with Y's (ie the max values)? And is it possible to hide the Y/N (flagging) column?

Thanks again for your help

Not applicable
Author

bump