Forum Discussion
Divide row by row
You can also write a measure such as the following:
Apple to Banana Ratio:= SUMX (
'TableName',
DIVIDE('TableName'[Banana],'TableName'[Apple])
)
Please mark it as a solution or give a kudo if it works for you, otherwise let me know if you run into an issue and I'll do my best to assist. Go To bipatterns.com for more techniques and user guides.
Thanks,
- sdjensen10 years agoSolution Sage
MarianaBotelho - could you perhaps show the result that you want.
I have created this small sample on your data and can get some different results:
Ratio is calculated as a measure with this formula: (I am still trying to understand why the total for this is 200)
Ratio = SUMX( Table1, DIVIDE( SUM(Table1[Banana]), SUM(Table1[Apple]) ) )
RatioColumn is calculated as a column in the table with this formula: (from what you write I think this is what you want)
RatioColumn = DIVIDE( Table1[Banana], Table1[Apple] )
- sdjensen10 years agoSolution Sage
Basically I would always advise you to solve your calculations with measures if posible and you can get Ratio to return the same total as the calculated column if you make a small change to the DAX formula.
Here is the formula that will return the same as the calculated column.
Ratio = SUMX( Table1, DIVIDE( CALCULATE( SUM(Table1[Banana]) ), CALCULATE( SUM(Table1[Apple]) ) ) )