The preceding recipe considers two static dates for the date range. We can also make the date range dynamic by tweaking our Set Analysis expression in the following way:
Sum({<DeliveryDate =
{">=$(=min(ShipmentDate))<=$(=max(ShipmentDate))"} >} Sales )
Here, we are comparing the delivery date to the shipment date and calculating sales for the delivery dates lying between the range of shipment dates.
For example:
- Add ShipmentDate as a new dimension to the Filter pane object.
- Select the shipment dates from 18/01/2015 to 25/01/2015.
- The resultant table shows the sales value only for the delivery date, as 24/01/2015: