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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
kanikasharma123
Frequent Visitor

Alternate Values for each employee id and date

Hi All,

I have a table with 1 column having employee ID, another having dates, and a third column having punch in and punch out time of each employee for each date. Assuming, every employee can have multiple in and out timings for a day. I want a column in which the minimum time for each date per employee to be the "InTime" and the maximum time for each date per employee to be the "OutTime". The time punches in between should alternate between "In" and "Out" based on the measure "count rows". If the measure is odd, the last two values must be "Out" and if measure is even, alternate values should be there. This is to be achieved in Power BI Hoping for some help. Thanks in advance!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@kanikasharma123 , Make sure you have date column first 

 

Date = Datevalue([punch in])

 

New columns

Min Punch in =  minx(filter(Table, [Emp] = earlier([Emp])  && [Date] = earlier([Date]) ), [punch in])

 

Max Punch out =  Maxx(filter(Table, [Emp] = earlier([Emp])  && [Date] = earlier([Date]) ), [punch out])

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@kanikasharma123 , Make sure you have date column first 

 

Date = Datevalue([punch in])

 

New columns

Min Punch in =  minx(filter(Table, [Emp] = earlier([Emp])  && [Date] = earlier([Date]) ), [punch in])

 

Max Punch out =  Maxx(filter(Table, [Emp] = earlier([Emp])  && [Date] = earlier([Date]) ), [punch out])

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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