Forum Discussion
Filtering two different dates by used og one date slicer
- 8 years ago
Hi Tove,
One way of doing this is to use TREATAS to apply the Date filter to the Delivery date column as well.
Assuming your tables are called Orders and Date, the measure would look like this:
Orders Delivered in Same Period = CALCULATE ( DISTINCTCOUNT ( Orders[Order ID] ), KEEPFILTERS ( TREATAS ( VALUES ( 'Date'[Date] ), Orders[Delivery date] ) ) )I assumed you wanted DISTINCTCOUNT of Order ID, but change as needed.
KEEPFILTERS is also there as a safeguard in case you are filtering on Delivery date, to ensure we stay within the current Delivery date filter context.
Out of interest - good article on TREATAS here.
Regards,
Owen
Hi Tove,
One way of doing this is to use TREATAS to apply the Date filter to the Delivery date column as well.
Assuming your tables are called Orders and Date, the measure would look like this:
Orders Delivered in Same Period =
CALCULATE (
DISTINCTCOUNT ( Orders[Order ID] ),
KEEPFILTERS ( TREATAS ( VALUES ( 'Date'[Date] ), Orders[Delivery date] ) )
)I assumed you wanted DISTINCTCOUNT of Order ID, but change as needed.
KEEPFILTERS is also there as a safeguard in case you are filtering on Delivery date, to ensure we stay within the current Delivery date filter context.
Out of interest - good article on TREATAS here.
Regards,
Owen
Thank you very much - it works and I have learn two new DAX formulas :-)
Tove