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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Vaibhav3008
Frequent Visitor

Need help to calculate from previous cell

Hi,

I have Client, Period and Hours column. Need to calculate Net change and %Growth columns in power BI

Please help in achieving this.

Vaibhav3008_0-1688535726334.png

 

3 REPLIES 3
Alf94
Super User
Super User

Hi @Vaibhav3008 ,

 

Can you please try the following?

 

Net change = 
        IF(
            SELECTEDVALUE( 'Table'[Client] ) =
            CALCULATE(
                MIN( 'Table'[Client] ),
                OFFSET(
                    -1,
                    ORDERBY( 'Table'[Client], ASC, 'Table'[Period], ASC )
                )
            ),
            CALCULATE(
                MIN( 'Table'[Hours] ) -
                CALCULATE(
                    MIN( 'Table'[Hours] ),
                    OFFSET(
                        -1,
                        ORDERBY('Table'[Client], ASC, 'Table'[Period], ASC)
                    )
                )
            )
        )

 

% Growth = 
    DIVIDE(
        [Net change],
        CALCULATE(
            MIN( 'Table'[Hours] ),
            OFFSET(
                -1,
                ORDERBY( 'Table'[Client], ASC, 'Table'[Period], ASC )
            )
        )
    )

 

Result:

Alf94_0-1688542660084.png

If I answered your question, please mark my post as a solution.

 

Best,

Thanks for the reply,

I applied it to my table and it says : Parameter is not the correct type

Vaibhav3008_0-1688545459971.png

Can you please help resolve it

@Vaibhav3008,

 

This is ok. Just validate your measure and put it in a visual, it should work.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.

Top Solution Authors