Forum Discussion

iamprajot's avatar
iamprajot
Responsive Resident
9 years ago
Solved

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  

 

 

 

4 Replies

  • malagari's avatar
    malagari
    Continued Contributor

    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. 

    • iamprajot's avatar
      iamprajot
      Responsive Resident

      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]))
      )