Quantcast
Channel: Desktop topics
Viewing all articles
Browse latest Browse all 213916

Time Intelligence: Adjusting time differences

$
0
0

Hi, 

 

Putting out a dax trick that i used to help adjust time differences for Time functions such as Yesterday / Today. 

 

In my dashboards, i usually show alot of tiles for data of Yesterday and Today - my timezone is GST, which is what applies to my data as well. I put my pbix model on a server that was UTC based, which is 4 hours behind - hence, everytime data in the pbix refreshed at 1am, because of the time difference, in my dashboards, yesterday's data (as per GST) would still show as 'today' because as per my server, at 1am GST, the server time was still 4 hours behind (i hope that makes sense). So, technically, for 4 hours, from 12am until 4am, my data for 'yesterday' and 'today' would be completely off. 

 

A very easy solution to adjust this, that i found after alot of brain wracking, was the following: 

 

datediff = DATEDIFF(tablename[Date],NOW()+TIME(4,0,0),DAY)

 

Essentially, this function adjusted the current server timezone by 4 hours (since i needed to add 4 hours to UTC to bring it to GST) and i simply used the result (0,1..)as a filter for Today / Yesterday respectively.

Being a comparative newbie at Dax, i really hope this helps someone who may be facing similar issues Smiley Happy


Viewing all articles
Browse latest Browse all 213916

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>