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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
georgec96
Helper II
Helper II

First and last datetime stamp

Hi everyone, I have the following dataset 

georgec96_0-1662553194823.png

 

I am trying to get the first and last datetime stamp for each shift (there are multiple shifts A,B,C,D) per day.

 

I have tried this formula but it doesn't work due to duplicated rows in the trndte column.

 

Measure = CALCULATE ( MIN ( 'Table'[trndte]), FIRSTDATE ( 'Table'[trndte] ) )

 

Any ideas would be much appreciated

 

Thanks

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @georgec96 

please try New Column

Last DateTime =
CALCULATE (
    MAX ( 'Table'[trndte] ),
    ALLEXCEPT ( 'Table', 'Table'[Shift], 'Table'[Date] )
)

 

View solution in original post

3 REPLIES 3
tamerj1
Super User
Super User

Hi @georgec96 

please try New Column

Last DateTime =
CALCULATE (
    MAX ( 'Table'[trndte] ),
    ALLEXCEPT ( 'Table', 'Table'[Shift], 'Table'[Date] )
)

 

@tamerj1  worked, thank you 

Anonymous
Not applicable

Hi @georgec96,
Can you try 
MinDate = CALCULATE ( MIN ( 'Table'[trndte]), ALLEXCEPT('Table'[Shift]))
MaxDate = CALCULATE ( MAX ( 'Table'[trndte]), ALLEXCEPT('Table'[Shift]))

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.