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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
cmcdowall
New Member

Assigning a Time to a Time Period

Hey,

 

As an example. If I have some data on when people have checked into work.

 

Employee NameCheck In TimeTime Period
Daffy Duck06:22:17?
Goofy12:56:24?
Wayne Rooney21:22:39?

 

I want to add a calculated column that works out the time period the check in falls into.

The Time Period Start and End boundaries will be based on a seperate table below.

 

Time PeriodTime StartTime End
106:00:0010:00:00
210:00:0016:00:00
316:00:0019:00:00
419:00:0000:00:00

 

I want it set up in a way that when I update the Time Start an Time End in this table my Time Period in the first table would update.

 

Many thanks,

 

@amitchandak @parry2k 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@cmcdowall ,

You can get a new column like this in table 2. And you can join both table on time id

Time id = maxx(filter(Table2, table1[Check In Time]>=table2[Time Start] && table1[Check In Time]<table2[Time End]),Table2[Time Period])

 

Also, you can get a column like , But better join two table

start time = maxx(filter(Table2, table1[Time id]=table2[Time Period]),Table2[Time Start])

 

Appreciate your Kudos.

 

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@cmcdowall ,

You can get a new column like this in table 2. And you can join both table on time id

Time id = maxx(filter(Table2, table1[Check In Time]>=table2[Time Start] && table1[Check In Time]<table2[Time End]),Table2[Time Period])

 

Also, you can get a column like , But better join two table

start time = maxx(filter(Table2, table1[Time id]=table2[Time Period]),Table2[Time Start])

 

Appreciate your Kudos.

 

amitchandak
Super User
Super User

I did not get it completely. Please explain with an example

But you can get a time table like :https://kohera.be/blog/power-bi/how-to-create-a-time-table-in-power-bi-in-a-few-simple-steps/

 

Work between period :https://kohera.be/blog/power-bi/how-to-create-a-time-table-in-power-bi-in-a-few-simple-steps/

Appreciate your Kudos.

 

parry2k
Super User
Super User

@cmcdowall not sure if I understood your question. You have a data table and you want to bring these time start and end column in your data table, correct? if that is the case, can you share how your data table looks like?

 

Read this post to get your answer quickly.

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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