cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

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

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors