Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Rigoleto
Helper II
Helper II

get value from Previous row

Need a funtion or logic to read a previous row, for instance:

 Fotos.png

 

 

 

 

 

 

 

 

 

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!!

 

 

 

1 ACCEPTED SOLUTION

@Rigoleto

 

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

gvc.png

View solution in original post

27 REPLIES 27
Anonymous
Not applicable

Hi,

 

I am really sorry for the inconvenience that occurred. Just forget about the first dataset I shared. In my previous email, I shared a Google sheet link with the dataset. Hope that would be helpful.

I still do n ot understand at all.  Sorry.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Rigoleto

 

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

gvc.png

Great solution, thank you @Rigoleto!

@Zubair_Muhammad 

Can we easly rebuilt this to get value from FIRST existing row? I tried by MIN etc. in my case i have date, not only month. SO i want get value with first date. 

@Zubair_Muhammad  Thank you so much !

Zubair_Muhammad
Community Champion
Community Champion

@Rigoleto

 

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

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.