Hi,@Learner DAX
week start should be Monday
You need to add this statement :
SET DATEFIRST 1 -- 1 => Monday, 7 => Sunday
Please check this :
SET DATEFIRST 7-- 1 = Monday, 7 = Sunday
declare @date datetime ='1/13/2022 10:00'
select Date+' 0:00' as [Date],Date+' '+cast(time as varchar)+':00' as [Hour],
datediff(d,@date,Date) as 'Date offset',
datediff(hh,@date,Date+' '+cast(time as varchar)+':00') as 'Hour offset',
time-datepart(hour,@date) as 'Hour of day offset',
datediff(m,getdate(),@date) as 'Month offset',
datediff(yy,getdate(),@date) as 'Year offset',
datediff(wk,getdate(),@date) as 'Week offset'
from #date D CROSS JOIN (values(0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16),(17),(18),(19),(20),(21),(22),(23))as T(time)
Something I am not sure is the difference between 'Hour of Day Offset' and 'Hour Offset'.
Best regards,
LiHong
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.