cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Retrieve value for the corresponding MIN value in other column

Hello!

 

I have been trying to figure out that for a while and now I realize I might need some help.

 

To simplify, I have a table similar to this.

 

CustomerYearPriceQuantity
A140100
A15010
A234121
A23512
B1452
B1401


I want to create a measure that would return corresponsing Quantity for the Row with the minimum price.

 

Something like this.

 

CustomerYearMin PriceQuantity
A140100
A234121
B1401

 

 

It is very easy to work with a measure of MIN ([Price]), but how to "VLOOKUP" quantity to it? I tried a lot of combinations of CALCULATE + FILTER, but it all gives a wrong result. I think I should use more of FILTER functions in the formula.

 

I do not want to create a duplicate table, because my current table is already big and I just feel I can do it with a measure..

 

Thanks!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Champion
Community Champion

Re: Retrieve value for the corresponding MIN value in other column

@Katerina_e

 

Hi, try with this:

 

MinPrice = MIN(Table1[Price])

 

Quantity of MinPrice =
VAR PRI = [MinPrice]
RETURN
    CALCULATE ( SUM ( Table1[Quantity] ); FILTER ( Table1; Table1[Price] = PRI ) )

Regards

Victor




Lima - Peru

View solution in original post

2 REPLIES 2
Highlighted
Community Champion
Community Champion

Re: Retrieve value for the corresponding MIN value in other column

@Katerina_e

 

Hi, try with this:

 

MinPrice = MIN(Table1[Price])

 

Quantity of MinPrice =
VAR PRI = [MinPrice]
RETURN
    CALCULATE ( SUM ( Table1[Quantity] ); FILTER ( Table1; Table1[Price] = PRI ) )

Regards

Victor




Lima - Peru

View solution in original post

Highlighted
Frequent Visitor

Re: Retrieve value for the corresponding MIN value in other column

Wow, that's easy and that looks like what I was up to. Thanks.

Helpful resources

Announcements
Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors