cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Applicable88
Helper V
Helper V

PowerBi server weekday vs. local weekday

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. 

 

 

1 ACCEPTED SOLUTION
Vera_33
Solution Sage
Solution Sage

Hi @Applicable88 

 

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)

 

View solution in original post

2 REPLIES 2
v-jingzhang
Community Support
Community Support

Hi @Applicable88 

 

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

Vera_33
Solution Sage
Solution Sage

Hi @Applicable88 

 

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)

 

View solution in original post

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

Top Solution Authors
Top Kudoed Authors