How to apply different levels of date filter?

macfuller

Active Member
Joined
Apr 30, 2014
Messages
319
Office Version
  1. 365
Platform
  1. Windows
I would like to return the date ranges for which products were substituted but I'm having difficulty with the filters.

I have a "sub" flag in my Orders table that indicates if a product was substituted (the product ID is different than that in our item master file). I have a calendar table relating the date to the PO Date. I would like to have my pivot table show only POs for the date range I have selected, but show the entire duration of the substitutions for those POs.

Example. During March-May 2017 product ID 123 (widgets) were substituted for product ID 456 (sprockets). First substitution day was March 1, last substitution day was May 31, duration was 92 days. If my timeline is set anywhere from March 2017 to May 2017 I want to see the sub 123 with those date values because we issued POs in those months where the substitution was occurring. If, however, I want to look at POs from June 2017 onward then I don't want that substitution to appear since we weren't subbing in that time frame.

Just looking at the first substitution date, if I use
First Sub Date:=CALCULATE(FIRSTDATE(Orders[PO Date]),Orders[Sub Status] = "Sub")

Then the value that is returned matches the timeline filter. In other words if I have selected April 2017 in the timeline then the measure will return April 1 as the earliest date and April 30 as the last sub date with duration of 30.

If I use

First Sub Date:=CALCULATE(FIRSTDATE(Orders[PO Date]),ALL(Calendar[Date]),Orders[Sub Status] = "Sub")

and have selected April 2017 on the timeline then I get the correct start and end date for the sub, but it also shows me product substitutions that did not occur within the timeline. So if I select June 2017 on the timeline I am still seeing substitutions with product 123 for the March-May time frame.

So, how do I create a date filter to just give POs for the filtered timeline, but to give me the full substitution history for those POs? I'm tying myself in knots trying to figure out which filter takes precedence!

Thanks for your help.
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Forum statistics

Threads
1,215,335
Messages
6,124,327
Members
449,155
Latest member
ravioli44

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top