Search code examples
excelpowerpivotdax

Excel Get values from previous Week


In Excel I have a pivot table with Rows containing week numbers. I now want one measure that shows the value of the previous week next to the value of this week.

I did this before for previous month with following formula, but in excel there isn't a function called PREVIOUSWEEK, so how can I do this ?

IF([Incident Count] <> 0; CALCULATE(COUNTA(Incidents[Call Number]);PREVIOUSMONTH('Calendar'[Date]));BLANK())

enter image description here

I want the value to keep appearing even if I use a slider to select one month:

enter image description here

Any idea how to achieve this so I can have a column next to "Sum of aangeboden oproepen" with the value from the previous week ?

enter image description here


Solution

  • You can use this formula. You will need to create index column based on weeks. Please adjust formula to your needs.

    =CALCULATE(SUM(Incidents[Incident count]),FILTER(ALL(Incidents),Incidents[Index]=MIN(Incidents[Index])-1))
    

    enter image description here