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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

July Newsletter

Fabric Community Update - July 2024

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