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: 
aparnanair1405
Contributor II
Contributor II

Finding the Top value in Pivot Table

Hi Community,

My data looks like the following table:  

DateCountryProductNumber of Contacts
15-OctIndiaA12
14-OctIndiaA14
13-OctIndiaA12
15-OctIndiaB16
14-OctIndiaB23
2-OctIndiaC7
3-OctIndiaC34
2-OctChinaD1
3-OctChinaD39
15-OctChinaA23
14-OctChinaA17
15-OctChinaE9

We need to provide a pivot table like the following:

CountryProduct receiving maximum contacts
IndiaC
ChinaA, D

Hope the question is clear.

Thanks in advance.

1 Reply
sunny_talwar

May be try this in a straight table:

Dimension: Country

Expression: Concat(Aggr(FirstSortedValue(Product, -Aggr(Sum([Number of Contacts]), Products, Country)), Product))

Expression: =Concat(DISTINCT If(Aggr(Sum([Number of Contacts]), Country, Product) = Aggr(Max(TOTAL <Country> Aggr(Sum([Number of Contacts]), Country, Product)), Country, Product), Product), ', ')

Capture.PNG