Forum Discussion
geetika3110
1 year agoFrequent Visitor
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)...
- 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()
)
nilendraFabric
1 year agoSuper User
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()
)
- geetika31101 year agoFrequent Visitor
Thank you so much for your support. I have to use the measure as I need to divide the aggregation of cost with the aggregation of quantity. The measure you suggested works. Thank you again