Forum Discussion

geetika3110's avatar
geetika3110
Frequent Visitor
1 year ago
Solved

DAX Measure to divide two columns based values in third column

Hi, I am looking for a DAX measure. I want to use a DAX measure to divide cost with quantity based on rollout column. e.g. in below table if the value in Rollout is "Full" then divide sum of Cost(Y1)...
  • nilendraFabric's avatar
    1 year ago

    geetika3110 Give it a try

     

    Res =
    VAR currentRollout = SELECTEDVALUE(Data[Rollout])
    RETURN
    SWITCH(
    currentRollout,
    "Full", DIVIDE(SUM(Data[Cost (Y1)]), SUM(Data[Quantity (Y1)])),
    "Half", DIVIDE(SUM(Data[Cost (Y1)]), SUM(Data[Quantity (Y2)])),
    BLANK()
    )