Forum Discussion

amaniramahi's avatar
amaniramahi
Helper V
6 years ago
Solved

Earlier Function

Hi,

 

I have the following table

 

ProductDateQtyPrevious Year Results
AAA1/1/20175 
BBB1/1/20173 
CCC1/1/20173 
AAA1/3/20178 
BBB1/3/20174 
CCC1/3/20176 
CCC1/9/20177 
AAA1/1/20186 
CCC1/1/20187 
BBB1/3/20187 
CCC1/9/20188 
AAA1/1/20199 
BBB1/3/20196 
CCC1/9/20197 

 

in "Previous Year Results" column, I wanted to calculate the sold qty for the same day in the previous year AND for the same product

 

When I type the following formula, it filters the dates

 

CACLCULATE(SUM(TABLE[QTY]),FILTER(TABLE,DATEADD(TABLE[DATE].[Date],1,YEAR)=EARLIER(TABLE[DATE].[Date])))

 

it works and sums the qty sold in the same date in previous year (regardless the product)

but When I add another filter with earlier value in Product type it gives me blank.

 

I need help

6 Replies