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
csanromano
Regular Visitor

Calculate difference between two rows

Hi. I am a beginner in Power BI; I do not know if this is the right forum.

I have the following table:

Year / Week / Value

2015 / 27 / 1000

2015 / 28 / 1010

2016 / 27 / 1200

2016 / 28 / 1205

I need to plot the value growth for each week YoY, ie 1200/1000 = 120% for the week 27 (YoY) and 1205/1010 = 119.3% for the week 28 (YoY)

I tried to do this by creating a column and a measure, but can not find the way.

The year and week, are values and no dates.

Some help?

1 REPLY 1
Anonymous
Not applicable

Hi, I just worked on your problem.. If this is column of two years then the below calculation will work:

 

DIVIDE(CALCULATE(SUM(Table1[Value]),FILTER('Table1','Table1'[Year]=MAX('Table1'[Year]))),(CALCULATE(SUM(Table1[Value]),FILTER('Table1','Table1'[Year]=MAX('Table1'[Year])-1))))
 
I build this formula in two sections
Numerator: 
CALCULATE(SUM(Table1[Value]),FILTER('Table1','Table1'[Year]=MAX('Table1'[Year])))
Denominator:
CALCULATE(SUM(Table1[Value]),FILTER('Table1','Table1'[Year]=MAX('Table1'[Year])-1))
then did the divide.
Below are the results:: Let me know if it works for you 🙂
 
Capture.PNG

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.

Top Solution Authors