cancel
Showing results for
Did you mean:
Helper IV

## 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

 Ticket CreatedDateTime Status A 5/6/2021 8:47 New 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
Community Support

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)``

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.

7 REPLIES 7
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:

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

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.

Helper IV

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

Community Support

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)``

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.

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

Helper IV

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

Resolver II

Hi @v_mark ,

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

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

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

Helper IV

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

Announcements