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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Build the column with flag if is the first date

Hi guys,
I have a table below:

Rick_ferreira_0-1618224656731.png

I need to build a an adicitonal column when shows 1 if the first date and 0 outherwise like this:

Rick_ferreira_1-1618224724360.png

 

Thanks

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Anonymous , Create a new column like

new column =
if([Date] = minx(filter(Table, [Id] = earlier([ID])),[Date]),1,0)

View solution in original post

Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

 

Please try the below for creating a new column.

 

is first =
VAR currentdate = 'Table'[Date]
VAR currentid = 'Table'[id]
VAR previousdateidcolum =
SUMMARIZE (
CALCULATETABLE ( 'Table', FILTER ( 'Table', 'Table'[Date] < currentdate ) ),
'Table'[id]
)
RETURN
IF ( currentid IN previousdateidcolum, 0, 1 )

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

 

Please try the below for creating a new column.

 

is first =
VAR currentdate = 'Table'[Date]
VAR currentid = 'Table'[id]
VAR previousdateidcolum =
SUMMARIZE (
CALCULATETABLE ( 'Table', FILTER ( 'Table', 'Table'[Date] < currentdate ) ),
'Table'[id]
)
RETURN
IF ( currentid IN previousdateidcolum, 0, 1 )

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


amitchandak
Super User
Super User

@Anonymous , Create a new column like

new column =
if([Date] = minx(filter(Table, [Id] = earlier([ID])),[Date]),1,0)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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