Forum Discussion
Recursive column in DAX or Power BI
Hi,
I am looking for to use recursive function on a particular column.
The requirement is to generate a fibonacci sequence based on the same column.
Eg: Assume we have only one column in a table and it has 2 rows:
1st Row = 100
2st Row =200
3st Row = 1st row + 2nd row = 300
4th Row = 2nd row + 3rd row = 500
and so on..
Also need a way to pass a variable's value to another variable in DAX.
Warm Regards,
Sreetej
1 Reply
- Greg_DecklerCommunity Champion
Anonymous - Believe me when I tell you, you cannot do true recursion in DAX. I have tried endlessly and have never found a way to beat the system. I have found some ways of sort-of-kind-of emulating it in certain situations or brute forcing things. Here are some of those:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Fibonacci/m-p/346531#M94
https://community.powerbi.com/t5/Quick-Measures-Gallery/Runge-Kutta/m-p/411280#M149
You CAN do true recursion in Power Query,
https://www.linkedin.com/pulse/fun-graphing-power-bi-part-5-by-5-greg-deckler-microsoft-mvp-/
For your last question, you do that with measures.
Finally, since I see that you are a New Member