Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
aaronnayan
Contributor 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

1 Solution

Accepted Solutions
Partner
Partner

Re: Set Analysis Question

per analogy :

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

result :

Capture.PNG

11 Replies
Partner
Partner

Re: Set Analysis Question

maybe:

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

or

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

Partner
Partner

Re: Set Analysis Question

per analogy :

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

result :

Capture.PNG

aaronnayan
Contributor III

Re: Set Analysis Question

Hi Omar its coming back with a null value

aaronnayan
Contributor III

Re: Set Analysis Question

Both are not working. Maybe becuase of the variable?

Partner
Partner

Re: Set Analysis Question

what's in the variable?

aaronnayan
Contributor III

Re: Set Analysis Question

I have changed the name of the fields for security

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

Partner
Partner

Re: Set Analysis Question

hi,

you have a mistake in the formula:


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


hope it helps,

Andrew

aaronnayan
Contributor III

Re: Set Analysis Question

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

The variable works fine on its own

Partner
Partner

Re: Set Analysis Question

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

It works?