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
BeAStar
Frequent Visitor

Filter a table with containing date ranges using an entered value from date table

I'm trying to filter a table (table 1) with an input date, tried using a date table (table 2) for the input (range date) but I'm not able to find a way to do it. Help would be appreciated very much.

BeAStar_1-1732639191599.png

This is what I tried but it doesn't work, the selectedDate is a messure in Table1

BeAStar_2-1732639854341.png

 

 

 

2 ACCEPTED SOLUTIONS
Jai-Rathinavel
Super User
Super User

@BeAStar Create a InRange measure with the DAX expression below

InRange = 
var sel = SELECTEDVALUE('Calendar'[SelectDate])
var result = 
    IF(
        AND(MAX(Contract[ServiceLifeStartDate]) <= sel,
            MAX(Contract[ServiceLifeEndDate]) >= sel),
            "Yes",IF(
                  ISBLANK(sel),BLANK(),"No")
        )
RETURN
result

 

Did I answer your question ? If yes, please mark my post as a solution.

 

Thanks,

Jai




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

Anonymous
Not applicable

Hi,

Thanks for the solution Jai-Rathinavel  offered, and i want to offer some more informatiorn for user to refer to.

hello @BeAStar , you can refer to the following soltuion.

Sample data is the same as you privided.

Create a calendar table., and create 1:n relationship between tables.(date->startdate)

Calendar = CALENDAR(DATE(2020,1,1),DATE(2025,12,31))

vxinruzhumsft_0-1732672300753.png

Then create a measure.

MEASURE =
VAR a =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        'Table'[Start Date] <= MAX ( 'Calendar'[Date] ),
        'Table'[End Date] >= MIN ( 'Calendar'[Date] ),
        CROSSFILTER ( 'Calendar'[Date], 'Table'[Start Date], NONE )
    )
RETURN
    IF ( a > 0, "Yes", "No" )

Then put the date of calendar table to the slicer, and put the measure and the contracts to the table visual.

Output

vxinruzhumsft_1-1732672389999.png

 

 

vxinruzhumsft_2-1732672428691.png

Best Regards!

Yolo Zhu

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

5 REPLIES 5
BeAStar
Frequent Visitor

Thank you so much!! was not getting the results needed but with suggestions IT WORKED!!!! Thanks Again!!!!

Anonymous
Not applicable

Hi,

Thanks for the solution Jai-Rathinavel  offered, and i want to offer some more informatiorn for user to refer to.

hello @BeAStar , you can refer to the following soltuion.

Sample data is the same as you privided.

Create a calendar table., and create 1:n relationship between tables.(date->startdate)

Calendar = CALENDAR(DATE(2020,1,1),DATE(2025,12,31))

vxinruzhumsft_0-1732672300753.png

Then create a measure.

MEASURE =
VAR a =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        'Table'[Start Date] <= MAX ( 'Calendar'[Date] ),
        'Table'[End Date] >= MIN ( 'Calendar'[Date] ),
        CROSSFILTER ( 'Calendar'[Date], 'Table'[Start Date], NONE )
    )
RETURN
    IF ( a > 0, "Yes", "No" )

Then put the date of calendar table to the slicer, and put the measure and the contracts to the table visual.

Output

vxinruzhumsft_1-1732672389999.png

 

 

vxinruzhumsft_2-1732672428691.png

Best Regards!

Yolo Zhu

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

 

BeAStar
Frequent Visitor

unfortunately it didn't work

@BeAStar it should work remove the relationship between table 1 and table 2. I tested it on my file and provided the output.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Jai-Rathinavel
Super User
Super User

@BeAStar Create a InRange measure with the DAX expression below

InRange = 
var sel = SELECTEDVALUE('Calendar'[SelectDate])
var result = 
    IF(
        AND(MAX(Contract[ServiceLifeStartDate]) <= sel,
            MAX(Contract[ServiceLifeEndDate]) >= sel),
            "Yes",IF(
                  ISBLANK(sel),BLANK(),"No")
        )
RETURN
result

 

Did I answer your question ? If yes, please mark my post as a solution.

 

Thanks,

Jai




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





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.

Top Solution Authors