Forum Discussion

STS_Joshua's avatar
STS_Joshua
Helper II
7 years ago
Solved

UTC time zone work around help

Hi all,

I have a report that uses the TODAY() function to calculate a few things such as sales made today:

today = CALCULATE(SUMX('Open','Open'[Quantity]*'Open'[Price]*'Open'[DocRate]),'Open'[DocDate]=today())

The problem is that the BI service uses UTC time and we are located in MST so this measure will return $0 at 6pm (UTC -6). I am pulling the data from our SQL server which is located locally and the report needs to remain a direct query report. The current time doesn't really matter to us, just the date so I thought of replacing TODAY() like this:

today = CALCULATE(SUMX('Open','Open'[Quantity]*'Open'[Price]*'Open'[DocRate]),'Open'[DocDate]=LASTDATE('Open'[DocDate]))

This is not allowed by the DAX police apparently...

 

Is there something else that I can do to work around this issue?

  • Hi STS_Joshua 

    Please check if below formula could help.

    today =
    SUMX (
        FILTER ( 'Open', 'Open'[DocDate] = LASTDATE ( 'Open'[DocDate] ) ),
        'Open'[Quantity] * 'Open'[Price] * 'Open'[DocRate]
    )
    

    Regards,

4 Replies

  • I'm going to try replacing TODAY() with NOW()-(6/24) which should hopefully subtract 6 hours from UTC and make the times match at least online. On desktop the report will think it's 6 hours prior but I don't think I'll have many reasons to run this report at 5am... 

     

    I do hope doing it this way won't just attempt to subtract 6 hours from UTC at midnight in this sort of fashion:

     

    NOW(): 5/24/2019 00:00 = NOW()-(6/24): 5/24/2019 00:00

    NOW(): 5/24/2019 01:00 = NOW()-(6/24): 5/24/2019 00:00

    NOW(): 5/24/2019 02:00 = NOW()-(6/24): 5/24/2019 00:00

    ...

    NOW(): 5/24/2019 07:00 = NOW()-(6/24): 5/24/2019 01:00