Forum Discussion
get value from Previous row
Need a funtion or logic to read a previous row, for instance:
How can you see Do I need is to sum up the previos record and build a new column with those values
Appreciate your help!!
I think this calculated column would work.
See the attached sample file as well
Calculated Column = VAR PreviousRow = TOPN ( 1, FILTER ( Table1, Table1[Month] < EARLIER ( Table1[Month] ) && Table1[Employee] = EARLIER ( Table1[Employee] ) ), [Month], DESC ) VAR PreviousValue = MINX ( PreviousRow, [Sales] ) RETURN Table1[Sales] + PreviousValue
27 Replies
- Zubair_MuhammadCommunity Champion
Try this Column
Column = VAR PreviousRow = TOPN ( 1, FILTER ( Table1, Table1[Column A] < EARLIER ( Table1[Column A] ) ), [Column A], DESC ) VAR PreviousValue = MINX ( PreviousRow, [Column B] ) RETURN Table1[Column B] + PreviousValue - Ashish_MathurSuper User
Hi,
Do youw want that as a measure or as a calculated column formula?
- RigoletoHelper II
Hi,
I would like as calculated column, please advise me about the logic , also include as measure if you can
- Ashish_MathurSuper User
Hi,
In what order should the numbers appear in column B? Should they be in descending order?
- RigoletoHelper II
Thanks a Lot for you help guys, this is the solution!!!!!
:)
- v-jiascu-msftMicrosoft Employee
- nakul555Frequent Visitor
Hello Zubair_Muhammad,
I was trying to do something similar but I have a large dataset (~2M rows) and PBI desktop is unable to process it. It gives me this error. I think it has something to do with 2 earlier statements.
Is there any other way we could do this?
- AnonymousNot applicable
Hi Please help me with this matter,
I need to sum up the current value with the previous month's value. Please help me to get this done in power bi. Appreciate your help.
- Ashish_MathurSuper User
Hi,
Share raw data in a format that can be pasted in an MS Excel file. Is the FY from Aug - Jul? If there is multiple years of data, then should the opening balance reset in August?
- AnonymousNot applicable
Hi Ashish,
We are calculating this for the current month onwards. If there are balance values we take it as an opening balance.
E.g:Month July(Opening Balance) Aug Sep Oct Nov Dec Jan Feb Mar Budget Sales 1747364 1559823 2818704 2547503 2909010 2237380 2558905 2017217 Probable Monthly Receipts - AR 8,613,088 1878993 3063531 2738160.92 763420.5 0 0 0 0 Probable Monthly Receipts - Budget Sales 0 0 0 0 1559823 2818704 2547503 2909010 Exposure 8,481,459 6,977,751 7,058,294 8,842,377 10,191,564 9,610,240 9,621,642 8,729,849 Here I want to get a measure for the Exposure row. That's the place I got confused about how to get a previous value and iterate the value over months.
- zbikraFrequent Visitor
Hi;
My problem is a very closed I've find on diff forums, but not exactly the same. So:
I want to calculate [start current daily stock] with the formula:
[start current daily stock] of the current day = [start current daily stock] of the previous day + [delivery] of the previous day - [daily consumption] of the previous day.
Please note that the value of [start current daily stock] for Today comes from an another source, so it's not calculated with the formula than further days.
Does Anybody to help me to solve my problem ?
Thx very mych in advance.
- Ashish_MathurSuper User
Hi,
I have solved a similar question in the attached files.
Hope this helps.
- zbikraFrequent Visitor
Hello Ashish,
Thanks very much for your help. It's just I'm looking for !