cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jorgeaguirre Frequent Visitor
Frequent Visitor

Showing only the last 3 hours.

I'm using: direct query

 

I need to make a filter that shows me in graph and a table the records of the last 3 hours with respect to the current time.


Is it possible to do this.?

 

¡¡¡¡¡¡¡HELP!!!!!!!!!

 

modelo_CONEXION_bdXOOM - Power BI Desktop_2.jpg

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Microsoft v-jiascu-msft
Microsoft

Re: Showing only the last 3 hours.

Hi @jorgeaguirre,

 

There are a way and a workaround. Please try it out.

1. Use "Top N" in visual level filter if your data is always up to now.Showing only the last 3 hours.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2. Create a measure, then filter the targets. (Refresh is needed to get the latest time)

 

IfLast3 =
VAR HourDiff =
    HOUR ( NOW () ) - HOUR ( MIN ( 'Table37'[Time] ) )
RETURN
    IF ( HourDiff >= 0 && HourDiff <= 3, 1, 0 )

Showing only the last 3 hours2.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Best Regards!

Dale

Community Support Team _ Dale
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
Microsoft v-jiascu-msft
Microsoft

Re: Showing only the last 3 hours.

Hi @jorgeaguirre,

 

There are a way and a workaround. Please try it out.

1. Use "Top N" in visual level filter if your data is always up to now.Showing only the last 3 hours.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2. Create a measure, then filter the targets. (Refresh is needed to get the latest time)

 

IfLast3 =
VAR HourDiff =
    HOUR ( NOW () ) - HOUR ( MIN ( 'Table37'[Time] ) )
RETURN
    IF ( HourDiff >= 0 && HourDiff <= 3, 1, 0 )

Showing only the last 3 hours2.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Best Regards!

Dale

Community Support Team _ Dale
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

jorgeaguirre Frequent Visitor
Frequent Visitor

Re: Showing only the last 3 hours.

Dale!

 

Thank you! I work well locally, but when I publish it I get different values.

 

 

locallocal.png

 published

publicado.png

 

 

 

 

Microsoft v-jiascu-msft
Microsoft

Re: Showing only the last 3 hours.

Hi @jorgeaguirre,

 

How about now? It seems the dates are different from the two pictures.

 

Best Regards!

Dale

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

Re: Showing only the last 3 hours.

Your Office tenant probably has its time zone set differently from wherever your data is being stored, so the apparent time difference is different from what you expect. You'll have to find out what that time difference is and correct for it in your filter calculation.


Did I answer your question? Please mark it as a solution.

Proud to be a Datanaut!
Super User I
Super User I

Re: Showing only the last 3 hours.

If you can't get into your company's Office admin panel, the quickest way would be to write a measure to check it and publish that.

 

Time Now = NOW()

 

Put that on a card visual and publish the report, see what it says and compare it to the local time on your data source.


Did I answer your question? Please mark it as a solution.

Proud to be a Datanaut!
jorgeaguirre Frequent Visitor
Frequent Visitor

Re: Showing only the last 3 hours.

True. The report is being used in a different region from which the data is stored in the service. The local time is 6 hours behind the server.

Super User I
Super User I

Re: Showing only the last 3 hours.

So you can still use the HourDiff suggestion from @v-jiascu-msft; you'll just have to subtract 6 hours from it.


Did I answer your question? Please mark it as a solution.

Proud to be a Datanaut!

Helpful resources

Announcements
Exclusive LIVE Community Event #3 – Ask Arun Anything

Exclusive LIVE Community Event #3 – Ask Arun Anything

Join us in the third Triple A event!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors