Forum Discussion
Get the value from previous row
Hello all! I am trying to execute a code to show me the value of the previous row in a new column whenever the value of the column "BOM Level" is equal to "NaN", as highlighted in orange in the second image.
Unfortunately I still couldn't find a way to do this in the M language (I'm using Power Query in Excel).
Thank you in advance 🙂
Current worksheet:
Result I'm trying to achieve:
Hi Anonymous ,
if you're serious about performance with previous rows in PQ, you should use the "Table.PreviousRow.pq"-function, I've posted here: https://www.thebiccountant.com/2018/07/12/fast-and-easy-way-to-reference-previous-or-next-rows-in-power-query-or-power-bi/
But I also have a series about BOM applications that you might be interested in: https://www.thebiccountant.com/2017/05/08/dynamic-bill-of-material-bom-solution-in-excel-and-powerbi/
2 Replies
- Greg_DecklerCommunity Champion
If it is OK to use DAX, you can use this: 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
If you need Power Query, use ImkeF
- ImkeFCommunity Champion
Hi Anonymous ,
if you're serious about performance with previous rows in PQ, you should use the "Table.PreviousRow.pq"-function, I've posted here: https://www.thebiccountant.com/2018/07/12/fast-and-easy-way-to-reference-previous-or-next-rows-in-power-query-or-power-bi/
But I also have a series about BOM applications that you might be interested in: https://www.thebiccountant.com/2017/05/08/dynamic-bill-of-material-bom-solution-in-excel-and-powerbi/