Forum Discussion
nankerp
Helper III
8 years agoLinear Depreciation - DAX
Im looking for a formula that can calculate linear depreciation (Capex divided years). Are there any who have tips about making formula in DAX that can manage this?
- 8 years ago
based on the originals tables you posted this should work, I'm assuming second table is named Parameter
Depreciation = VAR License = Inputtabel[License] VAR CurrentYear = Inputtabel[Year] VAR NrOfDeprYears = RELATED ( Parameter[Year depreciation] ) VAR CapexToDate = ADDCOLUMNS ( FILTER ( Inputtabel, Inputtabel[License] = License && Inputtabel[Year] <= CurrentYear && NOT ( ISBLANK ( Inputtabel[Capex] ) ) ), "NrOfYearsDepr", RELATED ( Parameter[Year depreciation] ) ) VAR FullCapexPerYear = FILTER ( GENERATE ( CapexToDate, GENERATESERIES ( [Year], [Year] + RELATED ( Parameter[Year depreciation] ) - 1, 1 ) ), [Value] = CurrentYear ) RETURN SUMX ( FullCapexPerYear, [Capex] / [NrOfYearsDepr] )
TomMartens
Super User
8 years agoHey,
I think that you can adapt the solution that is described here:
https://www.minceddata.info/2018/02/21/using-table-iterators-to-calculate-a-future-value/
to your need.
Regards,
Tom
I think that you can adapt the solution that is described here:
https://www.minceddata.info/2018/02/21/using-table-iterators-to-calculate-a-future-value/
to your need.
Regards,
Tom
nankerp
Helper III
8 years agoThank you very much. I have to spend some time to learn this formula but it look very interesting.
- Stachu8 years ago
Community Champion
based on the originals tables you posted this should work, I'm assuming second table is named Parameter
Depreciation = VAR License = Inputtabel[License] VAR CurrentYear = Inputtabel[Year] VAR NrOfDeprYears = RELATED ( Parameter[Year depreciation] ) VAR CapexToDate = ADDCOLUMNS ( FILTER ( Inputtabel, Inputtabel[License] = License && Inputtabel[Year] <= CurrentYear && NOT ( ISBLANK ( Inputtabel[Capex] ) ) ), "NrOfYearsDepr", RELATED ( Parameter[Year depreciation] ) ) VAR FullCapexPerYear = FILTER ( GENERATE ( CapexToDate, GENERATESERIES ( [Year], [Year] + RELATED ( Parameter[Year depreciation] ) - 1, 1 ) ), [Value] = CurrentYear ) RETURN SUMX ( FullCapexPerYear, [Capex] / [NrOfYearsDepr] )- nankerp8 years ago
Helper III
Thank you so much. I understand the formula and it will work.