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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
aaronnayan
Creator III
Creator III

Set Analysis Question

Hi Guys,

Really quick

i have a KPI :

max(aggr($(vMargin),[CustomerName]))

Which gives the value £

I want to get the Name 'String'of the customer with the most Margin?

Thanks

Labels (1)
1 Solution

Accepted Solutions
OmarBenSalem
Partner - Champion II
Partner - Champion II

per analogy :

='Customer with the most Sales : '&firstsortedvalue (customer, -aggr( sum(sales),customer))

result :

Capture.PNG

View solution in original post

11 Replies
OmarBenSalem
Partner - Champion II
Partner - Champion II

maybe:

=firstsortedvalue ([CustomerName], -aggr( max($(vMargin)),[CustomerName]))

or

=firstsortedvalue ([CustomerName], -max(aggr($(vMargin),[CustomerName])))

OmarBenSalem
Partner - Champion II
Partner - Champion II

per analogy :

='Customer with the most Sales : '&firstsortedvalue (customer, -aggr( sum(sales),customer))

result :

Capture.PNG

aaronnayan
Creator III
Creator III
Author

Hi Omar its coming back with a null value

aaronnayan
Creator III
Creator III
Author

Both are not working. Maybe becuase of the variable?

OmarBenSalem
Partner - Champion II
Partner - Champion II

what's in the variable?

aaronnayan
Creator III
Creator III
Author

I have changed the name of the fields for security

sum({<SInvoiceCount = {1}>} [Marginlcc]) + sum({<SCreditC = {1}>} [Marginlcc])

andrei_delta
Partner - Creator III
Partner - Creator III

hi,

you have a mistake in the formula:


sum({<SInvoiceCount = {1}>} [Marginlcc]]) + sum({<SCreditC = {1}>} [Marginlcc])


hope it helps,

Andrew

aaronnayan
Creator III
Creator III
Author

No andrew thanks for spotting that i changed it due to security

The variable works fine on its own

OmarBenSalem
Partner - Champion II
Partner - Champion II

What if u put the expression in ur variable directly in mine?

It works?