Power BI User on 02 Apr 2020 18:22:14
Create a DAX function that reads a given column, then creates a new column where the contents of each row in the original column are shifted n times above/below in the new column. This can be used for previous sales entries or moving range charts.
I have noticed there are many creative ways of achieving this in DAX (it must be DAX as this is needed for calculated columns) online, but most of these methods are quite resource hungry. Having an established method from you guys will help many in the Power BI community.
Big up to Power BI - I love it!
- Comments (1)
RE: DAX function to create column with shifted rows
I've created a proposal for adding ordered iterators in DAX. I think they could be used to get the shifts you're asking for.
https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/40647124-ordered-iterators