Forum Discussion

cham's avatar
cham
Post Patron
7 years ago

Difference between previous week

Hi,

 

 

Here is my data set,

Date SpendPay
22-07-19589.32425.22
24-07-193652.851833.72
21-07-193659.52744.64
24-07-192312.591726.67
24-07-19519.59347.25
24-07-1921178.4817955.15
24-07-193016.453734.56
22-07-192130.751562.65
31-07-19107.5268.16
31-07-196545.5
31-07-191430.741078.24
31-07-19108.315534.32
01-08-191011.2310910.91

 

I created a mesaure using this data set as below,

%Amount = (SUM('Sheet1'[Spend]) - SUM('Sheet1'[Total Pay])) / SUM('Sheet1'[Spend])

 

I want to get the diffrence between previous week %Amoun with this week. How can i do that?Hope this will help you because i provide the data set.

10 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hey cham 

    You can use a calculated column:

    % = CALCULATE(((SUM(T20[Spend]) - SUM(T20[Pay])) / SUM(T20[Spend])),
    FILTER(T20, T20[WEEKNUM] = EARLIER(T20[WEEKNUM])))

    Where WEEKNUM is another column:

    WEEKNUM = WEEKNUM(T20[Date ])

    I did NOT QA this solution.

     

    Thanks!
    A

    • cham's avatar
      cham
      Post Patron

      Hi Anonymous ,

       

      What is this T20 you mentioned in your measure? Can you please explain it to me?

      • Anonymous's avatar
        Anonymous
        Not applicable

        cham 

        Thats the table name.

        In your case it is Sheet1

        Thansk!
        A