Forum Discussion

csanromano's avatar
csanromano
Regular Visitor
10 years ago

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

  • Anonymous's avatar
    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 :)