Forum Discussion
Alphacom
2 years agoNew Member
recursive calculation
Hi, i need help, i'm in thi situation, i have table like this: date product order_qty forniture_qty stock_qty 01/01/2024 bag 10 ...
Greg_Deckler
2 years agoCommunity Champion
Alphacom Recrusive calculations are generally a problem and can't be done. However, this looks more like a calculated column that leverages a previous value. I am not certain though how you know you used 5 stock_qty. Bit confused by the data. But here is a general solution.
See my article on Mean Time Between Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/339586.
The basic pattern is:
Column =
VAR __Current = [Value]
VAR __PreviousDate = MAXX(FILTER('Table','Table'[Date] < EARLIER('Table'[Date])),[Date])
VAR __Previous = MAXX(FILTER('Table',[Date]=__PreviousDate),[Value])
RETURN
( __Current - __Previous ) * 1.