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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Petter120
Helper I
Helper I

If time value is between two other time values

Hi i have a column that has a time value for example 10:05:22 (hh:nn:ss). 

 

I am trying to figure out how to use an if statement that tests if the time value is between 10:00:00 and 10:59:59 but i cant figure it out. 

 

Can anyone help me out here please


Best regards 

Petter

1 ACCEPTED SOLUTION
AlB
Community Champion
Community Champion

Hi @Petter120

If Table[Column1] is what you want to check:

Table1[Column1] > TIME(10,00,00) && Table1[Column1] <= TIME(10,59,59)

View solution in original post

4 REPLIES 4
AlB
Community Champion
Community Champion

Hi @Petter120

If Table[Column1] is what you want to check:

Table1[Column1] > TIME(10,00,00) && Table1[Column1] <= TIME(10,59,59)

@AlB Thank you so simple 🙂

alena2k
Resolver IV
Resolver IV

hi! if you can do it in power query then I would use conditional column:

 

= Table.AddColumn(#"Prev Table", "Flag", each if ([Time] > #time(10, 0, 0) and [Time] < #time(11, 0, 0)) then "Yes" else "No")

 

if it is indeed inside one our, there is Start of the Hour option:

 

= Table.AddColumn(#"Prev Table", "Flag", each if Time.StartOfHour([Time]) = #time(10, 0, 0) then "Yes" else "No")

az38
Community Champion
Community Champion

Hi @Petter120 

there is not enough information.

There are could be a lot of solutions. At the first sight:

1. DATESBETWEEN() DAX function https://docs.microsoft.com/en-us/dax/datesbetween-function-dax

2. IF ([Column] >= TIME(10,0,0) && [Column] <= TIME(10,59,59), true(), false())

3. if(HOUR([Column]) = 10, true(), false())

 

The appropriate solution will depend on your business logic


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.