Forum Discussion
powerbidu
1 year agoFrequent Visitor
write measure/dax to calculate min max and % difference
Date Identifier Order Number Price 1-Oct A 123 1.15 1-Oct A 123 1.15 1-Oct A 124 1.00 1-Oct A 125 1.20 1-Oct B 126 2.00 1-Oct B 126 2.20 1-Oct C 127 3....
- 1 year ago
Hi, powerbidu
MaxPrice =
VAR OrderCount = CALCULATE(DISTINCTCOUNT(Data[Order Number]), ALLEXCEPT(Data, Data[Identifier]))
RETURN
IF(OrderCount > 1, CALCULATE(MAX(Data[Price]), ALLEXCEPT(Data, Data[Identifier])))Same for Min, change the MAX to Min.
PercentageChange = DIVIDE([MaxPrice] - [MinPrice], [MinPrice], 0)
Refer to the attached pbix file.
rubayatyasmin
Community Champion
1 year agoHi, powerbidu
MaxPrice =
VAR OrderCount = CALCULATE(DISTINCTCOUNT(Data[Order Number]), ALLEXCEPT(Data, Data[Identifier]))
RETURN
IF(OrderCount > 1, CALCULATE(MAX(Data[Price]), ALLEXCEPT(Data, Data[Identifier])))
Same for Min, change the MAX to Min.
PercentageChange = DIVIDE([MaxPrice] - [MinPrice], [MinPrice], 0)
Refer to the attached pbix file.