Forum Discussion

dbriggs's avatar
dbriggs
Frequent Visitor
9 years ago
Solved

DateTime.LocalNow

Good Morning

 

I'm calculating the difference between DateTime.LocalNow and the date of a work order.  My question is: does a calculated value based on DateTime.LocalNow automatically update each day or do you have to actively refresh the data?

 

Thanks

  • If it is part of the query, then DateTime.LocalNow will evaluate each time that the query refreshes, so you would have to actively refresh the data. If you want to do it in DAX, it would be the TODAY() or NOW() function and that would be updated each day automagically without a data refresh. Calculated columns in DAX are evaluated when the data model is opened/accessed.

4 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    If it is part of the query, then DateTime.LocalNow will evaluate each time that the query refreshes, so you would have to actively refresh the data. If you want to do it in DAX, it would be the TODAY() or NOW() function and that would be updated each day automagically without a data refresh. Calculated columns in DAX are evaluated when the data model is opened/accessed.

    • Tapco_AV's avatar
      Tapco_AV
      Regular Visitor

      Greg_Deckler

       

      I am currently running into this issue. Is there something I can do in Direct Query that automaticlly updates the today function? That is one of the last peices of the puzzle I am trying to figure out. The data is updating and flowing through, but I have one chart that is based off of dates and having the today column update on its own. Is there anything I can do?

       

      Thanks

  • dbriggs's avatar
    dbriggs
    Frequent Visitor

    Good Morning

    I'm calculating the difference between DateTime.LocalNow and the date of a work order.  Can anyone tell me if the calculated field automatically updates each time the file is opened or do you have to actively refresh the data.  Thanks