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! Learn more

Reply
stalerik
Helper II
Helper II

If Date is between two date columns in another table.

Hello,


I have Table 1 with a timestamp column with one minute for each row.

 

I have Table 2 with a Start Date and an End Date column.  I am trying to write a simple IF or SWITCH statement for a calculated column in Table 1 where it would be TRUE if the minute row is between each Start Date and End Date pair, and FALSE if it is not.  Some Start and End Dates overlap.  I have been trying to create a calculated column in DAX but I am open to doing this in Power Query instead.

 

Start DateEnd Date
04/26/2021 13:4504/26/2021 14:13
04/26/2021 14:4004/26/2021 17:03
04/26/2021 15:4404/26/2021 23:30
04/26/2021 21:4504/27/2021 05:28

 

Thanks in advance for any help/suggestions!

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi, @stalerik 

Please check the below picture and the sample pbix file for creating a new column.

 

Picture3.png

 

Result CC =
IF (
COUNTROWS (
FILTER (
Table2,
Table1[Timestamp] >= Table2[Start Date]
&& Table1[Timestamp] <= Table2[End Date]
)
) > 0,
"True",
"False"
)
 
 

Hi, My name is Jihwan Kim.


If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi, @stalerik 

Please check the below picture and the sample pbix file for creating a new column.

 

Picture3.png

 

Result CC =
IF (
COUNTROWS (
FILTER (
Table2,
Table1[Timestamp] >= Table2[Start Date]
&& Table1[Timestamp] <= Table2[End Date]
)
) > 0,
"True",
"False"
)
 
 

Hi, My name is Jihwan Kim.


If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
amitchandak
Super User
Super User

@stalerik , Try a new column like this in Table 1

 

if( countx(filter(Table2,Table1[Date] >= Table2[Start Date] && Table1[Date] <=Table2[end Date]), Table2[Strat date])+0>0, true(), false())

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.