Forum Discussion

sureshsonti's avatar
sureshsonti
Helper II
8 years ago
Solved

TODAY function

Hello,

I have a table with Order Date and Scheduled Qty. I created a measure to display today's orders using the TODAY function in DAX. But after 7 PM the report shows tomorrow's orders.

 

Please help

  • Hi sureshsonti,

     

    The Service uses UTC time. Maybe you can try the formula below.

    Yardage =
    IF (
        UTCNOW () = NOW (),
        CALCULATE (
            SUM ( YORX[Qty] ),
            FILTER ( 'YORX', 'YORX'[order_date] = DATEVALUE ( UTCNOW () + TIME ( 5, 0, 0 ) ) )
        ),
        CALCULATE (
            SUM ( YORX[Qty] ),
            FILTER ( 'YORX', 'YORX'[order_date] = TODAY () )
        )
    )
    

     

12 Replies

  • alexei7's avatar
    alexei7
    Continued Contributor

    Hi sureshsonti,

     

    That is odd - are you able to share the data model so that we can investigate? If the model contains sensitive data maybe you could remove it?

     

    Thanks

    Alex

     

    • sureshsonti's avatar
      sureshsonti
      Helper II

       

       

       

      This is my data model. Today's Volume will be showing 0 after 7 PM today. 

      Sch_Qty is what was ordered and Yardage is what was actually delivered

       

      I used this statement by creating a new measure. 

      Yardage = CALCULATE(SUM(YORX[Qty]),FILTER('YORX','YORX'[order_date]=TODAY()))

       

       

      So after 7 PM tonight it is showing tomorrow's orders. I am hiding some fields which are customer names and addresses. 

      My time zone is Central Standard Time (Baton Rouge, Louisiana)

       

      • v-jiascu-msft's avatar
        v-jiascu-msft
        Microsoft Employee

        Hi sureshsonti,

         

        I'm afraid I can't see from the snapshot that the measure shows tomorrow's orders.

        1. Is it what you want or what it should be that "Today's Volume will be showing 0 after 7 PM today"?

        2. Can you share a dummy sample of the original data? 

        3. Are there any wrong numbers in your snapshot?

         

        Best Regards,

        Dale