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.
Hello,
I need a function to return the day number of the real local time. My offset to the server are two hours. I use this for my calculated column which shows me the number of today. I created it and load data to double check if I get it right. value: Date.DayOfWeek(DateTime.FixedLocalNow(), Day.Sunday)
It works as long the lagging UTC Time from the server is on the same day, but not in the midnight time.
I use it in a nested if-statement for a Friday condition: if Date.DayOfWeek([Orderdate]) = 5 then........else..
Since its not a date and just a number, how to get it returns 5 even after thursday midnight to Friday, when server time is still two hours lagging and at day 4?
A combination with DateTimeZone.SwitchZone didn't return 5 as well, but only error.
Thank you in advance.
Best.
Solved! Go to Solution.
Not sure if I understand it correctly, so you want to know the weekday of server time and it is fixed 2 hours lagging, like this?
Date.DayOfWeek((DateTime.FixedLocalNow()- #duration(0,2,0,0)), Day.Sunday)
Have you tried @Vera_33 's solution? It should work. You can use it in your if-statement then. Kindly accept it as the solution if it helps solve this problem. If not, share more details about your expected result.
Regards,
Community Support Team _ Jing
Not sure if I understand it correctly, so you want to know the weekday of server time and it is fixed 2 hours lagging, like this?
Date.DayOfWeek((DateTime.FixedLocalNow()- #duration(0,2,0,0)), Day.Sunday)
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.