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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
v_mark
Helper V
Helper V

last 12 hours only

I have the table that looks like below.

out of 5, I should see only 3 as part of the last 12 hours (let's say its 9:07 CST AM now )


I'm planning to use it as a filter to show only the last 12 hours entries based on the current(now) time. 

so A B C will only show on the table/matrix. Need help

 

TicketCreatedDateTimeStatus
A5/6/2021 8:47New
B

5/6/2021 0:38

New
C

5/6/2021 0:34

New
D

5/5/2021 3:37

New
E

5/5/2021 0:04

New



1 ACCEPTED SOLUTION

Hi, @v_mark 

 

IF you want to work for the last 3 or 6 hours, You can change the number of Measure, if it's 3 hours, it's 3/24, if it's 6 hours, it's 6/24. as follows:

Flag = IF(MAX([CreatedDateTime])<=NOW()&&MAX([CreatedDateTime])>=NOW()-3/24,1,0)

v-yalanwu-msft_2-1620887749522.png

Best Regards,
Community Support Team_ Yalan Wu
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

7 REPLIES 7
v-yalanwu-msft
Community Support
Community Support

Hi @v_mark  , 

 

You could create a measure by the following formula:

Flag = IF(MAX([CreatedDateTime])<=NOW()&&MAX([CreatedDateTime])>=NOW()-0.5,1,0)

Then apply Flag measure to Filter:

v-yalanwu-msft_0-1620728180854.png

If you only want to see the top 3 records within 12 hours, you can add another filter:

v-yalanwu-msft_1-1620728180856.jpeg

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Will the same approach works for the last 3 or 6 hrs?

Hi, @v_mark 

 

IF you want to work for the last 3 or 6 hours, You can change the number of Measure, if it's 3 hours, it's 3/24, if it's 6 hours, it's 6/24. as follows:

Flag = IF(MAX([CreatedDateTime])<=NOW()&&MAX([CreatedDateTime])>=NOW()-3/24,1,0)

v-yalanwu-msft_2-1620887749522.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

dkaushik
Resolver II
Resolver II

Can you share a screen capture of what it looks like when you apply this filter? Also, check what it looks in pbi service when you publish it. If its showing different like mentioned in this post 
Solved: Date calculating differently on desktop and web du... - Microsoft Power BI Community

then you will need to convert it to specific timezone first (CST in your case) and then apply a filter on it.

 

Regards,

Dheeraj

Here's what it looks like in the pbi service. My current time is 11:12 AM 

v_mark_0-1620663141758.png

 

dkaushik
Resolver II
Resolver II

Hi @v_mark ,

 

You can try using "Relative time" option on your date slicer.

dkaushik_0-1620660864027.png

After that select "Last" and enter 12 and then select "Hours".

dkaushik_1-1620661029157.png

 

This will filter your data in the table visual. Also, if you don't want to use the slicer, you can use the same concept by dragging your "Date" field to Page Filters or Visual Filters and then select Relative Time from the options.

 

Please mark it as solution and give kudos if it helps you.

 

Thanks,

Dheeraj

My issue right there is it follows are completely different timezone. I'm in CST, I was hoping to see a time 12 hours from my time. Let's say currently it's 10:53AM I should see something like

10:53AM - 10:53PM 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.