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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Rupak_bi
Super User
Super User

Unable to refer previous row value of the current calculated column as we do in excel. Plz help

Unable to refer previous row value of the current calculated column as we do in excel. sample of the excel working attached. please guide

 

Rupak_bi_0-1710838913566.png

 



Regards
Rupak
FOLLOW ME : https://www.linkedin.com/in/rupaksar/
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Rupak_bi ,

 

You can try formula like below:

first_ =
IF ( 'Table'[Date] = MINX ( ALL ( 'Table' ), [Date] ), 0, BLANK () )
Column = 
VAR cur_date = 'Table'[Date]
VAR min_date =
    MINX ( ALL ( 'Table' ), 'Table'[Date] )
VAR first_value =
    MAXX ( FILTER ( ALL ( 'Table' ), 'Table'[Date] = min_date ), [first_] )
VAR cur_stock =
    CALCULATE (
        MAX ( 'Table'[Stock] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Date] <= cur_date )
    )
VAR next_ =
    CALCULATE (
        SUM ( 'Table'[Maximum  production] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Date] <= cur_date )
    ) + first_value
VAR result_ =
    IF (
        NOT ISBLANK ( 'Table'[first_] ),
        [first_],
        IF ( next_ < cur_stock, next_, cur_stock )
    )
RETURN
    result_

vkongfanfmsft_0-1711603748255.png

 

Best Regards,
Adamk Kong

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Rupak_bi ,

 

You can try formula like below:

first_ =
IF ( 'Table'[Date] = MINX ( ALL ( 'Table' ), [Date] ), 0, BLANK () )
Column = 
VAR cur_date = 'Table'[Date]
VAR min_date =
    MINX ( ALL ( 'Table' ), 'Table'[Date] )
VAR first_value =
    MAXX ( FILTER ( ALL ( 'Table' ), 'Table'[Date] = min_date ), [first_] )
VAR cur_stock =
    CALCULATE (
        MAX ( 'Table'[Stock] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Date] <= cur_date )
    )
VAR next_ =
    CALCULATE (
        SUM ( 'Table'[Maximum  production] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Date] <= cur_date )
    ) + first_value
VAR result_ =
    IF (
        NOT ISBLANK ( 'Table'[first_] ),
        [first_],
        IF ( next_ < cur_stock, next_, cur_stock )
    )
RETURN
    result_

vkongfanfmsft_0-1711603748255.png

 

Best Regards,
Adamk Kong

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Rupak_bi
Super User
Super User

hi @Anonymous 

Thanks for your reply. I have gone thorugh the articles but still unable to figureout the way to resolve it in dax. the source of the data is a calculated table and so cannot use query. please help if you have any idea to get those results.



Regards
Rupak
FOLLOW ME : https://www.linkedin.com/in/rupaksar/
Anonymous
Not applicable

Hi @Rupak_bi ,

 

This relates to the issue of circular dependencies encountered in creating calculated columns in powerbi. You may refer to the following blog:

Circular Dependency between Calculated Columns in ... - Microsoft Fabric Community

Realize circular dependency columns using M functi... - Microsoft Fabric Community

 

Best Regards,
Adamk Kong

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 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.