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
Y-Hernandez99P
Frequent Visitor

How can I check if an hour-type field is in a time range?

Good morning, my question is how can I check if the x column is in a time range? for example, from 3pm to 4pm?

Thanks for reading.

Here I show how the data is

erre.png

1 ACCEPTED SOLUTION
v-kelly-msft
Community Support
Community Support

Hi @Y-Hernandez99P ,

Create a measure as below:

Measure 2 = 
var a =HOUR(SELECTEDVALUE('Table (2)'[Time]))
Return
IF(a>=15&&a<=16,1,0)

And you will see:

Annotation 2020-04-30 141130.png

The rows which return 1 are in the time period from 3pm to 4pm.

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

View solution in original post

3 REPLIES 3
v-kelly-msft
Community Support
Community Support

Hi @Y-Hernandez99P ,

Create a measure as below:

Measure 2 = 
var a =HOUR(SELECTEDVALUE('Table (2)'[Time]))
Return
IF(a>=15&&a<=16,1,0)

And you will see:

Annotation 2020-04-30 141130.png

The rows which return 1 are in the time period from 3pm to 4pm.

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
amitchandak
Super User
Super User

You can use Hour function to get the hour to add one to it

 

Hour = Hour([Hora1])

Hour end = Hour([Hora1]) +1

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
camargos88
Community Champion
Community Champion

@Y-Hernandez99P ,

 

You can use the TIME function and IF.

 

https://docs.microsoft.com/en-us/dax/time-function-dax

 

Ricardo



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

Proud to be a Super User!



Helpful resources

Announcements
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