Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
LilMurph
Frequent Visitor

Generate a specific time when using Date function

Hi Everyone

 

I have created a column that provides the date of Thursday in Date/time format based on on the week number (given by another column [Week]) using the following formula:

Thursday = IF('Data'[Week]=1,date(2021,12,30), date(2022,1,((('Data'[Week])-1)*7)-1))
 
So if the [Week] column is 1 the date provided is 30/12/2021 00:00:00, if the [Week] column is 2 the date provided is 06/01/2022 00:00:00 and so on.
 
The problem is that I need the time to be 17:00:00 as this is the exact moment in the week that I need to refference as the cutoff point for staff submitting late timesheets. I have had a good goolge and tried a few things myself but I can't figure out how to specify a time. I tried concatinating a Date and a Time finction but that generates the Data type as Text and I need it to be in Date/time format. 
 
Any help would be greatly appriciated.
 
Cheers
LilMurph
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@LilMurph , Assume this is correct

Thursday = IF('Data'[Week]=1,date(2021,12,30), date(2022,1,((('Data'[Week])-1)*7)-1))

 

You can get with time like

Thursday = IF('Data'[Week]=1,date(2021,12,30), date(2022,1,((('Data'[Week])-1)*7)-1)) + time(17,0,0)

 

 

refer if needed for week start date

Any Weekday Week - Start From Any day of Week
https://community.powerbi.com/t5/Community-Blog/Any-Weekday-Week-Decoding-Date-and-Calendar-2-5-Powe...

 

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@LilMurph , Assume this is correct

Thursday = IF('Data'[Week]=1,date(2021,12,30), date(2022,1,((('Data'[Week])-1)*7)-1))

 

You can get with time like

Thursday = IF('Data'[Week]=1,date(2021,12,30), date(2022,1,((('Data'[Week])-1)*7)-1)) + time(17,0,0)

 

 

refer if needed for week start date

Any Weekday Week - Start From Any day of Week
https://community.powerbi.com/t5/Community-Blog/Any-Weekday-Week-Decoding-Date-and-Calendar-2-5-Powe...

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.