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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It 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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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