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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
cheskafausto
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

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! 

View solution in original post

4 REPLIES 4
v-shex-msft
Community Support
Community Support

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
If this post helps, please consider accept as solution to help other members find it more quickly.

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? 

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
If this post helps, please consider accept as solution to help other members find it more quickly.

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! 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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