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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
ovetteabejuela
Impactful Individual
Impactful Individual

Power Query | In between two times

Hi,

 

I think this is a very simple question to answer (probably why I can't find anything on the web) so I'm asking:

 

I want to check if a DateTime is in between 2 DateTimes

 

if DateTime(C) >= DateTime(A) or DateTime(C) <= DateTime(B) then 1 or 0

 

How do you do that in Power Query?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @ovetteabejuela,

 

You can add custom column in power query with if statement.

 

Sample:

    #"Added Custom" = Table.AddColumn(#"Previous step", "Custom", each if [C] >= [A] or [C] <= [B] then 1 else 0)

 

Regards,

Xiaoxin Sheng

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

HI @ovetteabejuela,

 

You can add custom column in power query with if statement.

 

Sample:

    #"Added Custom" = Table.AddColumn(#"Previous step", "Custom", each if [C] >= [A] or [C] <= [B] then 1 else 0)

 

Regards,

Xiaoxin Sheng

edhans
Super User
Super User

If they are in different columns, just reference the columns. If not, and you want to directly references the datetime, use the #datetime() function.

 

There is also a #date() function that is just #date(y,m,d)



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Kudoed Authors