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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
mo1988
Helper I
Helper I

DAX Calculation based on Previous Row

I have a dataset of columns (Index & Step 1)

I am trying to achieve the below calculations for Step 2 and Final

Any suggestions? Thanks

Issue.PNG

1 ACCEPTED SOLUTION

@mo1988 

It has to be of integer data or date (unique date) type. 

View solution in original post

4 REPLIES 4
mo1988
Helper I
Helper I

@tamerj1 I attempted to replace the index row value from the matrix to Month-Year column (Sept 2022, Oct 2022, ...) - Now the numbers are not accurate, does this only work with index?

@mo1988 

It has to be of integer data or date (unique date) type. 

mo1988
Helper I
Helper I

@tamerj1 Thank you! This works like magic! thanks alot 🙂 

tamerj1
Super User
Super User

Hi @mo1988 
Please refer to attached sample file with the solution

1.png

Step 2 = 
VAR CurrentIndex = 'Table'[Index]
VAR TableBefore = FILTER ( 'Table', 'Table'[Index] < CurrentIndex )
VAR P1 = COUNTROWS ( TableBefore ) + 1
RETURN
    SUMX ( 
        TableBefore,
        VAR X = 'Table'[Step 1]
        VAR P = P1 - 'Table'[Index]
        RETURN
            ( 0.5 ) ^ P * x
    )
Step 3 = 'Table'[Step 1] + 'Table'[Step 2]

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.