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

Showing graph based on current time

Hi everyone,

 

I am just starting with power bi desktop and service and I am not sure if this question has been asked already, so please bare with me. 

 

I have a set of forecasted data for a current day coming in through an Oracle database through direct query and the client application that alters the database, refreshes that data every hour.

 

Is it possible to make a calculation (measure or column) , so that , in the power bi service dashboard, it would only show a graph available at that current time?

 

For example, I have forecast data for the current day and it is 1pm at the moment. So in the dashboard, it should show only data from 12mn til 1pm. Once the clock strikes 2pm and the data refreshes on the dashboard, it should now show a graph 12mn til 2pm. 

1 ACCEPTED SOLUTION

Accepted Solutions
cheskafausto Frequent Visitor
Frequent Visitor

Re: Showing graph based on current time

Hello again, 

 

Fortunately, I got it to work the other day by adjusting the code. I filtered the datetime column to only show the current day and came up with this code below: 

 

#"custom step"=Table.SelectRows(#"Name of Previous Step", each ([Datetime]) <=(DateTime.LocalNow()))

 

Thank you for helping me out on this one! 

4 REPLIES 4
Community Support Team
Community Support Team

Re: Showing graph based on current time

Hi @cheskafausto,

 

You can try to add current time filter in query editor.

 

Sample:

 

#"custom step"=Table.SelectRows(#"Name of Previous Step", each Time.From([Datetime]) >=Time.From("0:00:00") and Time.From([Datetime])<=Time.From(DateTime.LocalNow()))

 

 

Reference link:

Power Query Current Date Filter

 

Regards,

Xiaoxin Sheng

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



For learning resources/Release notes, please visit: | |
cheskafausto Frequent Visitor
Frequent Visitor

Re: Showing graph based on current time

Hi v-shex-msft 

 

The code you provided worked perfectly, however, i had to change the querying mode to import. It does not allow this through direct query. I need this to work on direct query. Any ideas? 

Community Support Team
Community Support Team

Re: Showing graph based on current time

Hi @cheskafausto,

 

Based on test, current power bi query editor not support use dynamic filter parameter in 'direct query' mode.

 

Regards,

Xiaoxin Sheng

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



For learning resources/Release notes, please visit: | |
cheskafausto Frequent Visitor
Frequent Visitor

Re: Showing graph based on current time

Hello again, 

 

Fortunately, I got it to work the other day by adjusting the code. I filtered the datetime column to only show the current day and came up with this code below: 

 

#"custom step"=Table.SelectRows(#"Name of Previous Step", each ([Datetime]) <=(DateTime.LocalNow()))

 

Thank you for helping me out on this one!