Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I'm having a problem in retrieving the min value by two dimensions.
I mean I have this data structure
Product | Supplier | Avg Price |
---|---|---|
A | 1 | 1.5 |
A | 2 | 0.8 |
A | 3 | 2.1 |
B | 1 | 3.2 |
B | 2 | 4.2 |
B | 3 | 3.8 |
C | 1 | 7.1 |
C | 2 | 8.2 |
C | 3 | 6.9 |
and I need to obtain for each product the supplier having the min average price, that is to say:
Product | Supplier | Avg Price |
---|---|---|
A | 2 | 0.8 |
B | 1 | 3.2 |
C | 3 | 6.9 |
I've tryed a lot of combinations with min and aggr functions but with no results.
Can anyone help me?
Thanks in advance,
MJ
Hi MJ,
Is it working as your need?
Celambarasan
in dimension
Supplier
Product
Min(Aggr(sum(Amount)/count(Supplier),Supplier, Product))
hope this help
It works for the example but not in my dasboard, I'm checking it to find the problem....
Thanks a lot!
but... this is not the average price... sum(Amount)/count(Supplier)...
is it showing any error?
Hi,
Could you explain me briefly about the problem that currently your facing now.
Celambarasan
I've found the problem!!! I had some product puerchases that didn't have supplier so the average price was 0.
The expression Min(Total <Product> Aggr(avg(Amount/Quantity),Supplier, Product)) works perfectly now.
Thank you so much for your help!