Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I am trying to sum the Quantity Received based on the maximum price of the Component. Below is a table to try and demonstrate what I mean.
Component Price Qty
Product A 2.4 500
Product A 2.1 400
Product B 1.8 1000
So my dimension is component. And I have an expression to calculate the max price but I need to know how to then calculate the sum of the Qty bought in at the max price.
Any help is appreciated. Thank you in advance
=FirstSortedValue(Distinct Aggr(Max(Qty),Component),-Aggr(Max(Cost),Component))
Aggr(Max(Cost),Component)
This will give you Max(Cost) for each component (i.e. Aggr is used)
You definitely wants Max(Qty) wherever Component is having Max Price appear more than once...
To use the same you need to have Distinct in front as the FirstSortedValue is having NoDistinct by default...
Hope this helps..
No problem! Good luck