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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

New Column showing if row is First Date

Hello everyone, 

 

I have some data, and I would like to create two new columns based on the grouping of the incident number and the arrival time. 

  • 1st arriving unit - I would like to create a new boolean column stating if the datetime is the first depending on the incident number
  • Did not arrive flag - If the arrival time for a certain incident number is empty, I would like to create a boolean flag as TRUE for did not arrive. 

Original data: 

Incident NumberUnit Arrived On Scene Time
PB1900207269/26/2019 4:11 PM
PB190020736 
PB190020736 
PB190020736 
PB1900207409/26/2019 7:03 PM
PB1900207489/26/2019 10:21 PM
PB1900207519/26/2019 11:48 PM
PB190020751 
PB1900207519/26/2019 11:50 PM
PB1900207519/27/2019 12:06 AM
PB190020774 
PB1900207749/27/2019 9:12 AM
PB1900207749/27/2019 9:10 AM

 

Desired data: 

Incident NumberUnit Arrived On Scene Time1st Unit?didnotarriveflag
PB1900207269/26/2019 4:11 PMTRUEFALSE
PB190020736 FALSETRUE
PB190020736 FALSETRUE
PB190020736 FALSETRUE
PB1900207409/26/2019 7:03 PMTRUEFALSE
PB1900207489/26/2019 10:21 PMTRUEFALSE
PB1900207519/26/2019 11:48 PMTRUEFALSE
PB190020751 FALSETRUE
PB1900207519/26/2019 11:50 PMFALSEFALSE
PB1900207519/27/2019 12:06 AMFALSEFALSE
PB190020774 FALSETRUE
PB1900207749/27/2019 9:12 AMFALSEFALSE
PB1900207749/27/2019 9:10 AMTRUEFALSE

 

Would you know how I can do this? 

 

Thank you for your help, 

 

Denisse 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Try this:

 

1st arriving unit = SWITCH(TRUE(),
Planilha1[Unit Arrived On Scene Time] = BLANK(), "FALSE",
Planilha1[Unit Arrived On Scene Time] = Calculate(Min(Planilha1[Unit Arrived On Scene Time]) , Filter(Planilha1, Planilha1[Incident Number]=Earlier([Incident Number]))), "TRUE", "FALSE")
 
Did not arrive flag = IF(Planilha1[Unit Arrived On Scene Time] = BLANK(), "TRUE", "FALSE")

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Try this:

 

1st arriving unit = SWITCH(TRUE(),
Planilha1[Unit Arrived On Scene Time] = BLANK(), "FALSE",
Planilha1[Unit Arrived On Scene Time] = Calculate(Min(Planilha1[Unit Arrived On Scene Time]) , Filter(Planilha1, Planilha1[Incident Number]=Earlier([Incident Number]))), "TRUE", "FALSE")
 
Did not arrive flag = IF(Planilha1[Unit Arrived On Scene Time] = BLANK(), "TRUE", "FALSE")
Anonymous
Not applicable

@Anonymous it seemed to work, thank you so much!

amitchandak
Super User
Super User

@Anonymous , Please try the new columns in  dax , you can take the first one as Var in the second , if needed

 

First Date = minx(filter(Table,[Incident Number] =earlier([Incident Number]) && not(isblank([Unit Arrived On]))),[Unit Arrived On])


Time 1st Unit = if( [Unit Arrived On] = [First Date] , true(), false())

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

This is a job for Power Query, not for DAX.

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.