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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
mohany2211
Frequent Visitor

Difference between two rows

Hi..........i am trying to calculate the revenue growth between the two dates and based on criteria from another column, but not able to apply the correct formula. can someone help me with a formula to calcuate the same. Here is a small table with the data and expected result

 

thanks in advance for your help 

 

PIC.PNG

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @mohany2211,

 

In Previous Value you can use ABS(PreviousVaue). After return statement in my dax you can change this.

 

"
Return
DIVIDE((CurrentValue-PreviousValue),ABS(PreviousValue)) "

 

I am also attaching Pbix file with update. Please follow the link Remarks.pbix

 

Best Regards, 

Ravi

 

 

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @mohany2211,

 

I have taken your sample data and created a measure for your requirement. its working fine but could you please confirm is this your requirement.

Note: Please find the PBIX file i have attached here with name Remarks.pbix

 

 

Best Regards,

Ravi

Dear Ravi...thanks for the same. However...my issue is if previous figure is negative and current figure is poistive than also growth is coming as -ve refer table in my previous post.

 

Can you pls help how to rectify that

Anonymous
Not applicable

Hi @mohany2211,

 

In Previous Value you can use ABS(PreviousVaue). After return statement in my dax you can change this.

 

"
Return
DIVIDE((CurrentValue-PreviousValue),ABS(PreviousValue)) "

 

I am also attaching Pbix file with update. Please follow the link Remarks.pbix

 

Best Regards, 

Ravi

 

 

dobregon
Impactful Individual
Impactful Individual

Hi,

 

I think you need to do 2 things.


1. Create a column with previous value

  • You need to create a column that has the previous value (previous month as i see in your excel), try something like
    previous value = calculate(value or max (table[revenue]), filter(table, table[date]=date(year(date),month(date)-1,day(date))
    *Try to do this or add another filter

2. Create the measure revene growth like (revenue - prev revenue) / prev revenue



Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

@mohany2211

 

If you need a  calculated column then

 

Calc Column =
VAR previousvalue =
    MINX (
        TOPN (
            1,
            FILTER (
                Table1,
                [Remarks] = EARLIER ( [Remarks] )
                    && [Date] < EARLIER ( [Date] )
            ),
            [Date], DESC
        ),
        [Revenue]
    )
RETURN
    IF ( NOT ( ISBLANK ( previousvalue ) ), [Revenue] / previousvalue - 1 )

Regards
Zubair

Please try my custom visuals

Hi Zubair... the formula is working. However, there is one scenario which is giving incorrect result where growth is moving from -ve to +ve between two month than the value is coming as negative. Refer below 

 

DateEntity Revenue Column
June 2018BLUE     (10,961) 
July 2018BLUE     (28,239)157.62%
August 2018BLUE    107,039-479.05%
June 2018ABKID    (11,520) 
July 2018ABKID    (28,797)149.97%
August 2018ABKID    106,480-469.75%

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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