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
Mumin192
Helper I
Helper I

Filter date range based on another date range

Hello,

 

I have a table that have date start and date end

I have a date filter

I want to filter rows that have have at least one day in the date range

Is there something wrong with the logic, here?

Measure = CALCULATE(DISTINCTCOUNT(work_sessions_processed[user_id]),or(work_sessions_processed[date_end]>=MIN('Calendar'[Date]),work_sessions_processed[date_start]<=MAX('Calendar'[Date])))
 
Thanks
1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Mumin192 

please try

Measur =
CALCULATE (
    DISTINCTCOUNT ( work_sessions_processed[user_id] ),
    FILTER (
        work_sessions_processed,
        VAR StartDate = work_sessions_processed[date_start]
        VAR EndDate = work_sessions_processed[date_end]
        VAR Dates1 =
            CALENDAR ( StartDate, EndDate )
        VAR Dates2 =
            VALUES ( 'Calendar'[Date] )
        RETURN
            NOT ISEMPTY ( INTERSECT ( Dates1, Dates2 ) )
    )
)

View solution in original post

1 REPLY 1
tamerj1
Super User
Super User

Hi @Mumin192 

please try

Measur =
CALCULATE (
    DISTINCTCOUNT ( work_sessions_processed[user_id] ),
    FILTER (
        work_sessions_processed,
        VAR StartDate = work_sessions_processed[date_start]
        VAR EndDate = work_sessions_processed[date_end]
        VAR Dates1 =
            CALENDAR ( StartDate, EndDate )
        VAR Dates2 =
            VALUES ( 'Calendar'[Date] )
        RETURN
            NOT ISEMPTY ( INTERSECT ( Dates1, Dates2 ) )
    )
)

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.