0
votes

I am looking for a DAX formula in PowerPivot that shows last year value when date is previous year.

I have the following data (table) Data

I want to have a new column called "LastYear_Count" that shows values from previous year. For instance: Row Date:2/28/2017 - Branch: North - Count: 8 - LastYear_Count: 5 (since count value for last year 2/28/2016 was 5)

1

1 Answers

1
votes
Count Lastyear = CALCULATE(SUM(Table1[Count]);FILTER(Table1;Table1[Branche]=EARLIER(Table1[Branche]) && DATEADD(Table1[Date];1;YEAR)=EARLIER(Table1[Date])))

Result:

snip

Note: I've used the SUM aggregation, assuming there's only one 'count' for each day / branche combination. If this is not the case, please let us know.