Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
iamprajot
Responsive Resident
Responsive Resident

getting lowest value and highest value

Hi, I need to know how to get the lowest ShippingPrice and the highest ShippingPrice for a ProductID. Thanks

 

ProductIDShippingPriceLowest PriceHighest Price
532.38  
611.61  
465.83  
341.34  
451.30  
358.17  
522.98  
9148.33  
313.97  
481.91  
1140.51  
43.25  
455.09  
43.05  
848.29  
9146.06  
63.67  
255.28  
325.73  
4208.58  
866.29  
54.56  
1136.54  
64.54  

 

 

 

1 ACCEPTED SOLUTION
v-qiuyu-msft
Community Support
Community Support

Hi @iamprajot,

 

In addition, you can also create measures or calculated columns use ALLEXCEPT Function below:

 

Lowest Price = CALCULATE(MIN('Table2'[ShippingPrice]),ALLEXCEPT(Table2,'Table2'[ProductID]))

Highest Price = CALCULATE(MAX('Table2'[ShippingPrice]),ALLEXCEPT(Table2,'Table2'[ProductID]))

 

q2.PNG

 

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-qiuyu-msft
Community Support
Community Support

Hi @iamprajot,

 

In addition, you can also create measures or calculated columns use ALLEXCEPT Function below:

 

Lowest Price = CALCULATE(MIN('Table2'[ShippingPrice]),ALLEXCEPT(Table2,'Table2'[ProductID]))

Highest Price = CALCULATE(MAX('Table2'[ShippingPrice]),ALLEXCEPT(Table2,'Table2'[ProductID]))

 

q2.PNG

 

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Much appreciated, thanks.

malagari
Responsive Resident
Responsive Resident

This is perfect use for the EARLIER function.

 

Lowest Price = CALCULATE( MIN([Shipping Price]), 
FILTER(Table, [ProductID] = EARLIER([ProductID]))
)

 

And similar, you can switch MIN to MAX for the Highest Price for that Product.

 

The FILTER component will return a table of similar ProductIDs to the row being calculated on, and then the MIN function will return the lowest shipping price for this filtered table. 

Dan Malagari
Consultant at Headspring

Unfortunatly it shows an error and highlights the Red part

EARLIER/EARLIEST refers to an earlier row context which doesn't exist.

 

Lowest Price = CALCULATE( MIN([Shipping Price]), 
FILTER(Table, [ProductID] = EARLIER([ProductID]))
)

 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.