Forum Discussion

cheskafausto's avatar
cheskafausto
Frequent Visitor
8 years ago
Solved

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. 

  • 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

  • Anonymous's avatar
    Anonymous
    Not applicable

    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

    • cheskafausto's avatar
      cheskafausto
      Frequent Visitor

      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? 

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi cheskafausto,

         

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

         

        Regards,

        Xiaoxin Sheng