Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

karunpreet
Contributor II

Display the Customer Name who has paid the maximum Revenue

Hello Everyone,

I have multiple columns in table, but I have work with only 3 columns date, customer name and revenue.

For a single a Customer there can be multiple revenue.

I want to display the name of the customer who has the max value of Revenue, also the customer name who has given the maximum Revenue till now

How can that be achieved ?

For more clarity I will give an example

Customer Name     Revenue     Date

A                              100          01-01-1991

A                              200          01-01-1992

B                              300          01-01-1991

C                              250          01-01-1991

C                              400          01-01-1992

D                              500          01-01-1991

Customer who has the max value of Revenue is D i.e is 500

Customer who has given the maximum Revenue till now is C (250 + 400 = 650).

How can these values be displayed in a text box.

Thanking everyone in anticiaption

1 Solution

Accepted Solutions
MVP
MVP

Re: Display the Customer Name who has paid the maximum Revenue

For 1st

=FirstSortedValue([Customer Name], -Aggr(SUM(Revenue),[Customer Name],Date))

For 2nd

=FirstSortedValue([Customer Name], -Aggr(SUM(Revenue),[Customer Name]))

2 Replies
MVP
MVP

Re: Display the Customer Name who has paid the maximum Revenue

=FirstSortedValue(Customer, -Aggr(Sum(Name),Customer))

MVP
MVP

Re: Display the Customer Name who has paid the maximum Revenue

For 1st

=FirstSortedValue([Customer Name], -Aggr(SUM(Revenue),[Customer Name],Date))

For 2nd

=FirstSortedValue([Customer Name], -Aggr(SUM(Revenue),[Customer Name]))

Community Browser