Forum Discussion
PowerBI Service Timezone incorrect when checking if date is in current week
I am in UTC +10 without having to worry about daylight savings. How I get around the problem you describ is to create a query (with enable load as false) that works out what "Today's" date. Here is the code:
First have a simple constant (query with enable load as false) that contains your UTC adjustment which i called "c_LocalTimeAdjust"
let
Source = #duration(0,10,0,0)
in
Source(you could store a parameter that holds the 10/11 or do something smarter with it).
Now for the constant that holds todays date:
Date.From(DateTimeZone.RemoveZone(DateTimeZone.UtcNow()) + c_LocalTimeAdjust)This looks more complex than you expect, this is because Power Query tends to hold onto the timezone so its best to scrub it.
Hi Anonymous
Thank you so much for your help and apologies I am really slow with this stuff (still picking up and learning)
Does this solution mean I cannot use the function Date.IsInCurrentWeek?
There are some added benefits for me when using Date.IsInCurrentWeek as it defines the whole week (Monday - Sunday) for me.
I actually posted my whole use case here and the flow:
Your help is really appreciated!
- Anonymous2 years agoNot applicable
This specific solution gives you a date you can work with to solve many problems. Using the function you mentioned doesn't accept any parameters to help it get around your UTC problem.
In short, if you want to use the function you are locked into UTC. If you take my solution, you need to come up with a solution based on the idea i've given use as its basis.