Forum Discussion
kalpanaV
Helper IV
9 years agoDo calculation on cell level
Hi Here, i want to display in the new column for the first row (2/45)1*12 second row =( (2+3)/24)2*12 third row =((3+2+1)/30)/3*12 how to write dax.
Anonymous
9 years agoNot applicable
Hi kalpanaV,
You should use a iterator function like SUMX to do row based calculations.
The formula might need a little change because only in the third row i see you divide the result by 3*12 and because there is no desired result please check if the formule is fully correct.
First define a measure that counts the V column as a running total, I called it YTD but actually it uses the Index now. Consider using a date column so you could use an actual YTD function. Below the V_YTD and calculation like described.
V_YTD =
VAR CurrentIndex = MAX('Table'[Index])
RETURN
CALCULATE( SUM('Table'[v]);
FILTER(
ALLSELECTED('Table');
'Table'[Index] <= CurrentIndex
))
NewCalc =
VAR V = SUM('Table'[v])
VAR HC = SUM('Table'[HC])
VAR V_YTD = [V_YTD]
RETURN
SUMX(
'Table';
(V_YTD/HC)/'Table'[Index] * 12)Result: