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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Date Slicer or Filter for Hour(s)

Instead of filtering Data from yesterday's date, is it possible to filter from the last 24 hours? I have a date column with hours mins and seconds and would like to filter/slice data by hour if possible. 

 

 

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

Hi @Anonymous ,

 

We can use the following workaround to filter the last 24 hours in some visual:

 

1. create a table as slicer:

 

5.jpg

 

2. create a measure and use it in visual filter

 

Last24Hour = IF(SELECTEDVALUE('Show Last 24  Hours'[Show Last 24 Hours],FALSE()),IF(DATEDIFF(SELECTEDVALUE('Table'[Time]),NOW(),HOUR)<=24  && SELECTEDVALUE('Table'[Time]) <= NOW(),1,-1),1)

6.jpg7.jpg

 


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-lid-msft
Community Support
Community Support

Hi @Anonymous ,

 

How about the result after you follow the suggestions mentioned in my original post?Could you please provide more details about it If it doesn't meet your requirement?


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-lid-msft
Community Support
Community Support

Hi @Anonymous ,

 

We can use the following workaround to filter the last 24 hours in some visual:

 

1. create a table as slicer:

 

5.jpg

 

2. create a measure and use it in visual filter

 

Last24Hour = IF(SELECTEDVALUE('Show Last 24  Hours'[Show Last 24 Hours],FALSE()),IF(DATEDIFF(SELECTEDVALUE('Table'[Time]),NOW(),HOUR)<=24  && SELECTEDVALUE('Table'[Time]) <= NOW(),1,-1),1)

6.jpg7.jpg

 


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

The answer is "Probably" but the trickiness will be how real-time you would like it.

 

One method can be to add a "Last 24 hours" flag into your table  (Yes/No Field), based on DateTime.LocalNow().  You could do data math to check if the datetime is between DateTime.LocalNow() and DateTime.LocalNow() minus 1 day.  This will only show you "last 24 hours at the time of refresh".  This might be what you want.

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.