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.
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?
Solved! Go to 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,
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://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,
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,
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.