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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply

Slice by Hour

Hello,

 

I have live conneciton and I want to fiter the data by hour range like I want to filter after 4.30 pm. I have date and time in one column.

How can I create 24 hour filter which would slice the data? I have tried to use relative time but it give me whole hour.

 

Please guide me in the direction.

 

Thank you!

1 ACCEPTED SOLUTION
ValtteriN
Super User
Super User

Hi,

Here is one way to do this:

Data:

ValtteriN_0-1680896108848.png

 

Dax:

Filter after 4.30 =
var _selectedvalue = MAX('Table (30)'[Column1])
var _hour = HOUR(_selectedvalue)
var _min = MINUTE(_selectedvalue)
return

SWITCH(TRUE(),
_hour>=17,1, //check for after 17  
_hour>=16 && _min >= 30, 1, // check for 16:30-17
0) //if not these then 0

End result and explanation:

ValtteriN_1-1680896169061.png

 

Place the measure as a filter like in the picture. Afterthis you can apply relative date filter of 1 day. Since the measure will only allow values after 16.30 (4.30 pm) the result should be like you described.

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/




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

Proud to be a Super User!




View solution in original post

7 REPLIES 7
tamerj1
Super User
Super User

Hi @ValtteriN 
Please refer to attached sample file with the proposed solution.

1.png2.png4.png

Thank you for your help

ValtteriN
Super User
Super User

Hi,

Here is one way to do this:

Data:

ValtteriN_0-1680896108848.png

 

Dax:

Filter after 4.30 =
var _selectedvalue = MAX('Table (30)'[Column1])
var _hour = HOUR(_selectedvalue)
var _min = MINUTE(_selectedvalue)
return

SWITCH(TRUE(),
_hour>=17,1, //check for after 17  
_hour>=16 && _min >= 30, 1, // check for 16:30-17
0) //if not these then 0

End result and explanation:

ValtteriN_1-1680896169061.png

 

Place the measure as a filter like in the picture. Afterthis you can apply relative date filter of 1 day. Since the measure will only allow values after 16.30 (4.30 pm) the result should be like you described.

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/




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

Proud to be a Super User!




Thanks for your help but I want user to pick any hournot exac 4.30 and then filter the data. so how can I achieve that?

In that case you can use parameters. e.g.


Filter after 4.30 dynamic =
var _selectedvalue = MAX('Table (30)'[Column1])
var _hour = HOUR(_selectedvalue)
var _min = MINUTE(_selectedvalue)
return

SWITCH(TRUE(),
_hour>=[Hour Value] && _min >= [Minute Value], 1,
0)

Result:
ValtteriN_0-1680899335691.png

 

So insert parameters from here:
ValtteriN_1-1680899371696.png

 

For hours 0 to 23 and for minutes 0 to 59. Increment 1




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

Proud to be a Super User!




P_d2023
Regular Visitor

Hi, you can split the hour from the date/column in the data view.

 

if you create a custom column and use the below dax expression. you can then use the hour in a seperate filter.

 

this will round the hour back so 20:59 would show as 20

 

P_d2023_0-1680895496025.png

P_d2023_1-1680895532678.png

 

 

as I am using live connection, I cant create column or table. do you have any other way?

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.