Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Fia123
Helper II
Helper II

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 same periode.  Eg. if I choose jan-feb 2018, I want to know how many orders have both order date and delivery date in this period.

 

I have a date table which is connected to the order date - and I know how to used date table and date slicers 🙂

 

Tove

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

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


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

View solution in original post

2 REPLIES 2
OwenAuger
Super User
Super User

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


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

Thank you very much - it works and I have learn two new DAX formulas 🙂

 

Tove

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors