-
Re: Aggr with FirstSortedValue
Sebastian Pereira Mar 31, 2018 12:51 PM (in response to BHARATH KUMAR)Hi!
If you use Aggr(sum(UnitSales),Product)), you will get only one value of UnitSales by each one Product.
If you want to get a table with Product Dimmention and only one Expression with the top UnitSales Customer:
Dimmention: Product
Expression: FirstSortedValue(Customer,-aggr(sum(UnitSales),Customer,Product))
-
Re: Aggr with FirstSortedValue
BHARATH KUMAR Apr 1, 2018 6:35 AM (in response to Sebastian Pereira)Hi Sebastian Pereira,
Thanks for your response.
I got it, but i just want to know,
Why I got A.Astrida for Expression : FirstSortedValue(Customer, -Aggr(Sum(UnitSales), Product))
why not the other 2 Customers !!
OK.Thanks Anyway!
-
Re: Aggr with FirstSortedValue
Sebastian Pereira Apr 1, 2018 1:52 PM (in response to BHARATH KUMAR)if you get only one value for each product (with aggr), you get the same value for each Customer. So, FirstSortedValue gives your anyone.
If it resolved your question, please mark as answered !
-
-
-
Re: Aggr with FirstSortedValue
Anil Babu Apr 1, 2018 12:27 PM (in response to BHARATH KUMAR)For others, You can try like this?
FirstSortedValue(Customer, -Aggr(Sum(UnitSales), Product),1)
FirstSortedValue(Customer, -Aggr(Sum(UnitSales), Product),2)
FirstSortedValue(Customer, -Aggr(Sum(UnitSales), Product),3)
OR
Concat(FirstSortedValue(Customer, -Aggr(Sum(UnitSales), Product)), ',')
-
-
Re: Aggr with FirstSortedValue
Sunny Talwar Apr 1, 2018 12:53 PM (in response to BHARATH KUMAR)May be try this
Concat(Aggr(If(Sum(TOTAL <Product> UnitSales) = Max(TOTAL Aggr(Sum(TOTAL <Product> UnitSales), Product, Customer)), Customer), Product, Customer), ', ')
-
Re: Aggr with FirstSortedValue
BHARATH KUMAR Apr 4, 2018 2:51 AM (in response to Sunny Talwar )Thanks Sunny Talwar !!
-
-
Re: Aggr with FirstSortedValue
Gagan Bhasin Apr 2, 2018 1:32 AM (in response to BHARATH KUMAR)HI Bharath,
For your desired result, consider Anil Babu's answer. You aren't getting the desired result as the aggr function is giving one value, which is again been ranked on the basis of Product which effectively remains same, as you have already grouped by Product, so in any case, you'll be getting only one value.
Hope it helps.
Regards,
Gagan