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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

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())

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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