Forum Discussion
Fetch previous and next row based on column value
- Anonymous5 years ago
Hi Anonymous ,
According to your DAX, I think you want to group by the ID column to get the value of the previous or next row. The following is the method in Power Query.
1.Refer to this article to get a ranking by category. And copy the original table to get the second table, the first table sorting starts from 2, and the second table sorting starts from 1.
2.Then merge two tables.
3.Expand the table
What the example shows is to get the next row. If you want to get the previous row, just change the rank order.
You can check more details from the attachment.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous ,
According to your DAX, I think you want to group by the ID column to get the value of the previous or next row. The following is the method in Power Query.
1.Refer to this article to get a ranking by category. And copy the original table to get the second table, the first table sorting starts from 2, and the second table sorting starts from 1.
2.Then merge two tables.
3.Expand the table
What the example shows is to get the next row. If you want to get the previous row, just change the rank order.
You can check more details from the attachment.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
This is really great! Thank you! 🙂