Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Min value by two dimensions

Hello,

I'm having a problem in retrieving the min value by two dimensions.

I mean I have this data structure

ProductSupplierAvg Price
A11.5
A20.8
A32.1
B13.2
B24.2
B33.8
C17.1
C28.2
C36.9

and I need to obtain for each product the supplier having the min average price, that is to say:

ProductSupplierAvg Price
A20.8
B13.2
C36.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

1 Solution

Accepted Solutions
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     In that case use this expression for min price

          Min(Total <Product> Aggr(avg(Amount/Quantity),Supplier, Product))

Celambarasan

View solution in original post

16 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Image not displayed that you have attached.

Celambarasan

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Use this expression,

     =If([Avg Price]=min(TOTAL <Product> [Avg Price]),[Avg Price])

Hope this will help you.

Celambarasan

rohit214
Creator III
Creator III

Hi

try this

=aggr(min([Avg Price]) ,Product)

may it hepls you

thanks

rohit

Not applicable
Author

Thanks you both!!

I've tryed with the expressions you mentioned and this one (=If([Avg Price]=min(TOTAL <Product> [Avg Price]),[Avg Price])) works perfectly for th example but not for my dashboard. When I include a new dimension It doesn't work.

Find attached a new example that includes Time Dimension. If I select a month the min value is correct but it is incorrect if no month is selected.

Thanks!

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     I'm sorry to say this i cann't open your qv file because i'm using personal edition. Can u give me as a image.

Celambarasan

Not applicable
Author

Find attached the images.

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Here Avg Price means?..How your calculating i mean like its from datasource or calculating in chart if so based on what?

Not applicable
Author

I'm calculating  in the chart as 'amount/quantity'

Find attached the table i'm using.

These are the expessions for each column:

Avg Price: =avg(Amount/Quantity)

Min Price: =min(TOTAL <Producto> Amount/Quantity)

Thank you so much!!!

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     In that case use this expression for min price

          Min(Total <Product> Aggr(avg(Amount/Quantity),Supplier, Product))

Celambarasan