Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
joaovieira
Partner - Contributor II
Partner - Contributor II

Set Analysis

Hello community, i am trying to create a KPI that returns the country of the customer that has the more sales, to get the customer i used this expression:

concat(aggr(if(rank(sum({$<Year={'$(vMaxYear)'},OrderDate={'<=$(vMaxDate)'}>}SalesFinal))<2,Customer),Customer),',')

Now the idea is to select the country of the person that the expression returns, any ideas?

Thank you for the help

1 Solution

Accepted Solutions
Mark_Little
Luminary
Luminary

HI

If your above set analysis is working. i would try putting it in a Variable. vCustomer

Then trying ONLY({<Customer={'$(vCustomer)'}>}Country).

Mark

View solution in original post

4 Replies
Anonymous
Not applicable

If your expression works then you should just be able to change the "Customer" field to "Country" field as the data is linked so you will get the same result but it will return the Country

Mark_Little
Luminary
Luminary

HI

If your above set analysis is working. i would try putting it in a Variable. vCustomer

Then trying ONLY({<Customer={'$(vCustomer)'}>}Country).

Mark

agigliotti
Partner - Champion
Partner - Champion

maybe this:

=Only( Aggr( if( sum({$< Year = {'$(vMaxYear)'}, OrderDate = {'<=$(vMaxDate)'} >} SalesFinal) =

Max( Aggr( sum({$< Year = {'$(vMaxYear)'}, OrderDate = {'<=$(vMaxDate)'} >} SalesFinal), Country ) ), Country, null() ), Country ) )

joaovieira
Partner - Contributor II
Partner - Contributor II
Author

Thank you, it works well and it will help with other things i wasn't able to do.