0
votes

Is it possible to reference the previous row of the column I am currently creating? Not in calculate column but in measure?

enter image description here

For example, in Excel with can do like this in the above image.

Q4 = If(N3> 0,  N3 + O4 + P4, Q3 + O4 + P4) 

Q5 = If(N4> 0,  N4 + O5 + P5, Q4 + O5 + P5) and so on.

But I couldn't find a way to do so in Power BI...

I have created a visual table below in Power BI, and now need to add the new measure like column Q in Excel in my visual table.

enter image description here

I saw many posts and videos are using Earlier in the calculated column, but I would need to create this with a measure.

I have been trying this for many hours, it would be great if someone has solutions.

Thank you very much in advance!

1

1 Answers

0
votes

In general, no, you cannot recursively self-reference the same column that you are trying to define.

This looks like it might be convertible to a closed-form formula where before May 2020 you calculate using Inventory, Inbound, and Outbound as expected and after May 2020 you take the inventory from April 2020 plus the cumulative sum of Inbound and Outbound from April to whatever month you're on. Ugly to write but seems possible.