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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
emilyrichardson
Frequent Visitor

Filter by time as well as date

Hi

I'm trying to find a way where I can get power BI to allow the user to filter by time and date. 

The idea is that the user will be able to filter to anything that was added to the system between 5pm yesterday and 5pm today (and they would view this the following morning). It gets a little bit more tricky over the weekend, as the user should be able to filter to anything added to the system from Thursday 5pm to Sunday 5pm. I can do this filter easily in the filter pane by dragging the date field there and specifying times, but I want the user to be able to do that. 

emilyrichardson_0-1726240900361.png

 

Here is some example data

Prod NumberTime presentation sent
119/07/2024 10:51
219/07/2024 11:55
319/07/2024 13:30
419/07/2024 13:54
522/07/2024 17:48
623/07/2024 05:55
723/07/2024 06:10
823/07/2024 17:05
924/07/2024 07:27
1024/07/2024 10:03
1125/07/2024 13:26
1225/07/2024 15:21
1325/07/2024 15:36
1426/07/2024 06:52
1526/07/2024 08:00
1626/07/2024 08:24
1726/07/2024 11:32
1827/07/2024 07:43
1927/07/2024 08:52
2027/07/2024 10:52
2127/07/2024 11:05
2229/07/2024 13:24
2329/07/2024 14:23
2429/07/2024 16:55
2530/07/2024 08:03
2630/07/2024 10:05
2730/07/2024 16:21
2831/07/2024 07:38
2931/07/2024 08:47
3031/07/2024 15:55
3131/07/2024 19:26
3201/08/2024 09:49
3301/08/2024 15:04
3402/08/2024 10:15
3502/08/2024 11:11
3602/08/2024 17:32
3703/08/2024 05:56
3803/08/2024 11:56
3905/08/2024 06:03
4005/08/2024 06:14
4105/08/2024 09:40
4205/08/2024 16:19
4305/08/2024 17:48
4406/08/2024 08:09
4506/08/2024 16:11
4607/08/2024 06:34
4707/08/2024 00:00
4808/08/2024 05:59
4908/08/2024 06:32
5008/08/2024 06:33
5108/08/2024 07:07
5208/08/2024 07:10
5309/08/2024 05:38
5409/08/2024 07:43
5509/08/2024 07:46
5612/08/2024 06:04
5712/08/2024 07:03
5812/08/2024 08:19
5912/08/2024 08:19
6013/08/2024 12:01
6114/08/2024 05:35
6214/08/2024 07:47
6314/08/2024 11:38
6414/08/2024 13:30
6515/08/2024 05:55
6616/08/2024 09:15
6719/08/2024 05:49
6819/08/2024 05:57
6919/08/2024 10:09
7020/08/2024 08:44
7120/08/2024 11:05
7222/08/2024 06:04
7323/08/2024 05:45
7423/08/2024 06:02
7527/08/2024 17:01
7628/08/2024 15:23
7728/08/2024 16:04
7828/08/2024 16:57
7928/08/2024 21:11
8029/08/2024 06:03
8129/08/2024 11:01
8229/08/2024 18:53
8330/08/2024 08:26
8430/08/2024 10:12
8502/09/2024 05:48
8602/09/2024 13:57
8702/09/2024 14:19
8802/09/2024 16:36
8902/09/2024 16:52
9003/09/2024 06:00
9103/09/2024 12:04
9204/09/2024 08:04
9304/09/2024 17:16
9404/09/2024 17:29
9504/09/2024 17:44
9605/09/2024 08:06
9705/09/2024 08:18
9805/09/2024 08:26
9905/09/2024 12:35
10006/09/2024 05:56
10106/09/2024 09:08
10206/09/2024 20:10
10309/09/2024 05:49
10410/09/2024 05:32
10510/09/2024 08:07
10610/09/2024 10:22
10710/09/2024 13:32
10810/09/2024 15:04
10911/09/2024 05:41
11011/09/2024 06:47
11111/09/2024 12:36
11211/09/2024 15:26
11311/09/2024 19:58
11412/09/2024 05:33
11512/09/2024 19:03
11612/09/2024 19:17
11712/09/2024 22:02
11813/09/2024 05:28
11913/09/2024 17:44
12013/09/2024 23:16
12116/09/2024 08:13
12216/09/2024 08:13
12316/09/2024 08:13
12416/09/2024 10:22
12517/09/2024 05:57
12617/09/2024 06:32

If anyone has a way of doing this it would be greatly appreciated. Thank you! 

1 ACCEPTED SOLUTION

@emilyrichardson 

 

then you need to have another table for your timestamps (like DimDate) and dont use any relation between this table and your table. and write a measure as follows:

 

measure inbetween := var min_date = min(Dimdate[date_time])

var max_date = max(Dimdate[date_time])

return

if( your_table [timestamp] >=min_date && your_table[timestamp] <=max_date , 1 , 0 )

add this to filters of page and set it to 1.

SelvaSalimi_0-1726650237781.png

 

then you can ask your end user to select two time dates ( not all in between) to see result. this is the easiet solution I recommend but there are other solutions too.

 

 
If this post helps, then I would appreciate a thumbs up  and mark it as the solution to help the other members find it more quickly. 

View solution in original post

8 REPLIES 8
v-yilong-msft
Community Support
Community Support

Hi @emilyrichardson ,

I create a table as you mentioned.

vyilongmsft_0-1726465780641.png

Then I add EntryDateTime column into a slicer and choose Relative Date Style.

vyilongmsft_1-1726466194044.png

So you can do what you want.

vyilongmsft_2-1726466292269.pngvyilongmsft_3-1726466315148.png

 

 

 

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

elitesmitpatel
Solution Supplier
Solution Supplier

Please share the dummy pbix file for easy reference

Hi, thanks for the response! Here is some dummy data. 

Prod NumberTime presentation sent
119/07/2024 10:51
219/07/2024 11:55
319/07/2024 13:30
419/07/2024 13:54
522/07/2024 17:48
623/07/2024 05:55
723/07/2024 06:10
823/07/2024 17:05
924/07/2024 07:27
1024/07/2024 10:03
1125/07/2024 13:26
1225/07/2024 15:21
1325/07/2024 15:36
1426/07/2024 06:52
1526/07/2024 08:00
1626/07/2024 08:24
1726/07/2024 11:32
1827/07/2024 07:43
1927/07/2024 08:52
2027/07/2024 10:52
2127/07/2024 11:05
2229/07/2024 13:24
2329/07/2024 14:23
2429/07/2024 16:55
2530/07/2024 08:03
2630/07/2024 10:05
2730/07/2024 16:21
2831/07/2024 07:38
2931/07/2024 08:47
3031/07/2024 15:55
3131/07/2024 19:26
3201/08/2024 09:49
3301/08/2024 15:04
3402/08/2024 10:15
3502/08/2024 11:11
3602/08/2024 17:32
3703/08/2024 05:56
3803/08/2024 11:56
3905/08/2024 06:03
4005/08/2024 06:14
4105/08/2024 09:40
4205/08/2024 16:19
4305/08/2024 17:48
4406/08/2024 08:09
4506/08/2024 16:11
4607/08/2024 06:34
4707/08/2024 00:00
4808/08/2024 05:59
4908/08/2024 06:32
5008/08/2024 06:33
5108/08/2024 07:07
5208/08/2024 07:10
5309/08/2024 05:38
5409/08/2024 07:43
5509/08/2024 07:46
5612/08/2024 06:04
5712/08/2024 07:03
5812/08/2024 08:19
5912/08/2024 08:19
6013/08/2024 12:01
6114/08/2024 05:35
6214/08/2024 07:47
6314/08/2024 11:38
6414/08/2024 13:30
6515/08/2024 05:55
6616/08/2024 09:15
6719/08/2024 05:49
6819/08/2024 05:57
6919/08/2024 10:09
7020/08/2024 08:44
7120/08/2024 11:05
7222/08/2024 06:04
7323/08/2024 05:45
7423/08/2024 06:02
7527/08/2024 17:01
7628/08/2024 15:23
7728/08/2024 16:04
7828/08/2024 16:57
7928/08/2024 21:11
8029/08/2024 06:03
8129/08/2024 11:01
8229/08/2024 18:53
8330/08/2024 08:26
8430/08/2024 10:12
8502/09/2024 05:48
8602/09/2024 13:57
8702/09/2024 14:19
8802/09/2024 16:36
8902/09/2024 16:52
9003/09/2024 06:00
9103/09/2024 12:04
9204/09/2024 08:04
9304/09/2024 17:16
9404/09/2024 17:29
9504/09/2024 17:44
9605/09/2024 08:06
9705/09/2024 08:18
9805/09/2024 08:26
9905/09/2024 12:35
10006/09/2024 05:56
10106/09/2024 09:08
10206/09/2024 20:10
10309/09/2024 05:49
10410/09/2024 05:32
10510/09/2024 08:07
10610/09/2024 10:22
10710/09/2024 13:32
10810/09/2024 15:04
10911/09/2024 05:41
11011/09/2024 06:47
11111/09/2024 12:36
11211/09/2024 15:26
11311/09/2024 19:58
11412/09/2024 05:33
11512/09/2024 19:03
11612/09/2024 19:17
11712/09/2024 22:02
11813/09/2024 05:28
11913/09/2024 17:44
12013/09/2024 23:16
12116/09/2024 08:13
12216/09/2024 08:13
12316/09/2024 08:13
12416/09/2024 10:22
12517/09/2024 05:57
12617/09/2024 06:32
 
  •  
Selva-Salimi
Super User
Super User

hi @emilyrichardson 

 

I am not sure if I understand your issue, but in the way that user be able to filter any date and any hour you can add slicer in the dashboard.

 

but in fact I don't think that it was the issue. I think that you want to dynamically update dashboard based on last previous working day. if so, let me know.

Hi, thanks for getting back to me! I don't need the power bi to refresh dynamically, but if that is the only way around it happy to set that up. I need the user to specifiy what date they would like to view and power bi to know they mean between 5 to 5. I've posted some dummy data to the intial post, as using a slicer I can't work out how to get the slicer to look at date as well as time. I can't use within last lets say 12 hours as I'm not sure when the user will be looking at the dashboard to see the data. 

@emilyrichardson 

 

you can add an slicer to the dashboard and use "relative time" option in slicer setting. if it does not fulfill your expectations then you can do the following steps:

 

1. create a column Hour = FORMAT(Time_presentation , "HH")

2. add an slicer to the dashboard, add time_presentation which is in YYYY-MM-DD format and create a hierarchy under date which is the hour column you craete before, in this situation end user can select date and also time.

 

If this post helps, then I would appreciate a thumbs up  and mark it as the solution to help the other members find it more quickly.

@Selva-Salimi thank you for your response. 

I have done it slightly differently based off of your response. All I have done is split the date and time into two seperate columns and added that to the slicer, my only issue is that its a drop down and doesn't allow me to do an inbetween, as that would reduce human error, where I am only asking the user to enter the two dates they want to look between and not select all the dates and times. 

emilyrichardson_0-1726649113560.png

 

@emilyrichardson 

 

then you need to have another table for your timestamps (like DimDate) and dont use any relation between this table and your table. and write a measure as follows:

 

measure inbetween := var min_date = min(Dimdate[date_time])

var max_date = max(Dimdate[date_time])

return

if( your_table [timestamp] >=min_date && your_table[timestamp] <=max_date , 1 , 0 )

add this to filters of page and set it to 1.

SelvaSalimi_0-1726650237781.png

 

then you can ask your end user to select two time dates ( not all in between) to see result. this is the easiet solution I recommend but there are other solutions too.

 

 
If this post helps, then I would appreciate a thumbs up  and mark it as the solution to help the other members find it more quickly. 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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