Forum Discussion

Kr1s's avatar
Kr1s
Frequent Visitor
6 years ago

SAMEPERIODLASTYEAR with filters

Hi,

 

I have a dataset consisting of all sales from 2016 to present day. There are multiple entries per date broken down by payer, customer, product group and product.

 

Whenever I use SAMEPERIODLASTYEAR it returns nothing. I am assuming due to the complexity of the data.

 

Is there a way to use SAMEPERIODLASTYEAR with 4 filters, i.e. if payer, customer, product group and product match?

 

I have tried doing the filter myself but still can't get any meaning full data.

 

Here is an example of my dataset:

 

DatePayerCustomerProduct GroupProductQuantity
01/01/2016AA1PG1PG1A1
01/01/2016BB1PG2PG2A2
01/01/2016CC1PG1PG1A3
01/01/2016AA2PG1PG1A4
01/01/2016DD1PG2PG2A5
01/01/2017BB1PG2PG2A2
01/01/2017BB1PG1PG1A3
01/01/2017DD2PG2PG2A4
01/01/2017EE1PG1PG1A5
01/01/2017AA1PG1PG1A1
01/01/2018AA1PG1PG1A3
01/01/2018CC1PG1PG1A4
01/01/2018BB1PG2PG2A5
01/01/2018DD1PG2PG2A1
01/01/2018EE1PG1PG1A2

 

Here is what i expect to see from the output:

 

DatePayerCustomerProduct GroupProductQuantityLY Data
01/01/2016AA1PG1PG1A1 
01/01/2016BB1PG2PG2A2 
01/01/2016CC1PG1PG1A3 
01/01/2016AA2PG1PG1A4 
01/01/2016DD1PG2PG2A5 
01/01/2017BB1PG2PG2A22
01/01/2017BB1PG1PG1A3 
01/01/2017DD2PG2PG2A4 
01/01/2017EE1PG1PG1A5 
01/01/2017AA1PG1PG1A11
01/01/2018AA1PG1PG1A31
01/01/2018CC1PG1PG1A4 
01/01/2018BB1PG2PG2A54
01/01/2018DD1PG2PG2A1 
01/01/2018EE1PG1PG1A25

 

Any help is greatly appreciated.

 

Thanks,

 

Kristian

 

6 Replies