Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
sameershivalkar
Contributor II
Contributor II

Get Dimension with Highest Value in straight table

Hello Team,

I am new to qlik,need your help.

I have created a straight table where i want to display total amount for customer ie if customer A has value 144,444,78 then in the output 666 need to display against A.

Values in dimension field would be value with highest amount ie in our case details Account 123 data need to be displayed .

CustomerAccountDateCodeAmount
A1206-04-2017MA144
A12307-02-2019TD444
A12504-01-2016SD78
B5403-03-2019SD74
B7401-01-2016MA52

 

Output

Output    
CustomerAccountDateCodeAmount
A12307-02-2019TD666
B5403-03-2019SD126

 

I have already displayed total value sum(aggr(sum(Amount),customer) but i am not able to display fields against highest amount ie as Account 123 has highest Amount so that data need to be displayed

A12307-02-2019TD

 

Thanks in advance

6 Replies
JordyWegman
Partner - Master
Partner - Master

Hi Sameer,

Try this: 

IF(Max(Aggr(Sum(Amount),Customer,Account)) = Max(Total Aggr(Sum(Amount),Customer,Account)),Sum(Amount), null())

Jordy

Climber 

Work smarter, not harder
sameershivalkar
Contributor II
Contributor II
Author

Hello Jordy,

Need to display fields against highest value.

Regards,

Sameer

sunny_talwar

Try this may be

Sum(Aggr(If(Sum(Amount) = Max(TOTAL <Customer> Aggr(Sum(Amount), Customer, Account)), Sum(TOTAL <Customer> Amount)), Customer, Account))
JordyWegman
Partner - Master
Partner - Master

Hi Sameer,

Why do you want the customer and account number? Because 666 is not related to that account number, only to the customer because for the account its 444.

If you do want it then do this for your measure:

 

Sum(Aggr(Sum(Amount),Customer))

 

And this for the account as a calculated dimension:

 

IF(Max(Aggr(Sum(Amount),Account)) = Max(Total Aggr(Sum(Amount),Account)), Account, null())

 

Jordy

Climber

Work smarter, not harder
sameershivalkar
Contributor II
Contributor II
Author

Thank you so much sunny this worked i was struggling for this from so long 🙂

 

sameershivalkar
Contributor II
Contributor II
Author

Also need a small help if total Amount is greater than 400 then Row would be displayed