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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
STS_Joshua
Helper II
Helper II

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?

1 ACCEPTED SOLUTION

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,

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
STS_Joshua
Helper II
Helper II

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

Hi @STS_Joshua 

There're two workarounds for you.One in dax and the other in query editor.Please check if below posts could help.

https://community.powerbi.com/t5/Desktop/DateTimeZone-UtcNow-not-working-properly-in-Power-BI-Servic...

https://radacad.com/solving-dax-time-zone-issue-in-power-bi

For 3rd party Links:

Please understand that this link is provided “AS IS” with no warranties or guarantees of content changes, and confers no rights.

Regards,

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

As I mentioned above, I changed all the TODAY() to NOW()-(6/24) and that is displays the time in the right time zone. The strange thing is that when I went to access the report sales for the day went to (Blank) after 1800MST (UTC-6) while the time still showed as correct for the time zone.

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,

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors