Forum Discussion

powerbidu's avatar
powerbidu
Frequent Visitor
1 year ago
Solved

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....
  • rubayatyasmin's avatar
    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.