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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Fátima
Helper II
Helper II

Filter two dates with just one filter

Hi!

 

I need to filter two columns by one given date. For example, I have registries with the columns "START_DATE" and "END_DATE", so by filtering by date it would return the registries which start_date is before the filter date, and the end date is after the filter date. In other words, I need the registries in which dates range is the date of the filter.

 

Is this possible to do with a date slicer? I have tried to create one and set both fields to filter, but it doesn't allow me to use the slider nor to set different options (greater than and smaller than) for each column. If not, how can I set a filter that allows me to do this?

 

Thanks! Regards!

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @Fátima 

 

You can try the following methods.

Sample data:

vzhangti_0-1675406786905.png

New table:

Date = CALENDAR(MIN('Table'[START_DATE]),MAX('Table'[END_DATE]))
Measure =
IF ( SELECTEDVALUE ( 'Date'[Date] ) = BLANK (), 1,
    IF ( SELECTEDVALUE ( 'Date'[Date] ) >= SELECTEDVALUE ( 'Table'[START_DATE] )
         && SELECTEDVALUE ( 'Date'[Date] ) <= SELECTEDVALUE ( 'Table'[END_DATE] ),
        1,
        0
    )
)

vzhangti_1-1675407153857.png

Result:

vzhangti_2-1675407582963.png

vzhangti_3-1675407614973.png

Hope this method helps you.

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
v-zhangti
Community Support
Community Support

Hi, @Fátima 

 

You can try the following methods.

Sample data:

vzhangti_0-1675406786905.png

New table:

Date = CALENDAR(MIN('Table'[START_DATE]),MAX('Table'[END_DATE]))
Measure =
IF ( SELECTEDVALUE ( 'Date'[Date] ) = BLANK (), 1,
    IF ( SELECTEDVALUE ( 'Date'[Date] ) >= SELECTEDVALUE ( 'Table'[START_DATE] )
         && SELECTEDVALUE ( 'Date'[Date] ) <= SELECTEDVALUE ( 'Table'[END_DATE] ),
        1,
        0
    )
)

vzhangti_1-1675407153857.png

Result:

vzhangti_2-1675407582963.png

vzhangti_3-1675407614973.png

Hope this method helps you.

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.