Forum Discussion
getting lowest value and highest value
- 9 years ago
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]))
Best Regards,
Qiuyun Yu
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.
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]))
)