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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
maxsheva
Creator II
Creator II

Get Max field value with the Max result in an expression

Hi,

Plan:

LOAD * INLINE [

Channel, Plan

Retail, 100

E-commerce, 50

Wholesale, 20

];

Concatenate(Plan)

Fact:

LOAD * INLINE [

Channel, Fact

Retail, 70

E-commerce, 20

Wholesale, 20

];

PlanFact:

LOAD Channel,

  sum(Fact)/sum(Plan) as Result

Resident Plan Group by Channel;


Drop Table Plan;

I need get value in Text object from a 'Channel' field with the maximum result.


In this case must be "Wholesale"


If possible please add it to the file.

Thx.

1 Solution

Accepted Solutions
sunny_talwar

May be this

=FirstSortedValue(Channel, -Aggr(sum(Fact)/sum(Plan), Channel))

View solution in original post

3 Replies
craigsutton
Creator
Creator

FirstSortedValue(Channel, -Result)

maxsheva
Creator II
Creator II
Author

It works fine.

But I missed something.

Result calculation is in Variable

vResult = sum(Fact)/sum(Plan)

Below variant doesn't work.

FirstSortedValue(Channel, -$(vResult))

sunny_talwar

May be this

=FirstSortedValue(Channel, -Aggr(sum(Fact)/sum(Plan), Channel))