Forum Discussion

Fia123's avatar
Fia123
Helper II
8 years ago
Solved

Filtering two different dates by used og one date slicer

Hi, I hope someone can help be with the following issue: I have a table with Order ID, Ordre date and Delivery date. I would like to count how many orders in a given period are also delivered in sa...
  • OwenAuger's avatar
    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