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

Add a sequence number by ID and date/time

I have a table with an alphanumeric ID field and a modified date & time field. I need another column that assigns a sequence numer by ID and date/time. 

 

So this:

IDModified Date
INC0000019148628/9/2017 16:27
INC0000019148628/9/2017 18:04
INC0000019148628/9/2017 20:22
INC0000019148628/9/2017 22:39
INC0000019148628/10/2017 15:21
INC0000019167688/12/2017 16:07
INC0000019167688/12/2017 16:25
INC0000019167688/12/2017 16:27
INC0000019167688/12/2017 16:32
INC0000019167688/12/2017 18:37

 

Needs to return this:

IDModified DateSequence
INC0000019148628/9/2017 16:271
INC0000019148628/9/2017 18:042
INC0000019148628/9/2017 20:223
INC0000019148628/9/2017 22:394
INC0000019148628/10/2017 15:215
INC0000019167688/12/2017 16:071
INC0000019167688/12/2017 16:252
INC0000019167688/12/2017 16:273
INC0000019167688/12/2017 16:324
INC0000019167688/12/2017 18:375

 

Thoughts?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Can add this as a calculated column:

Sequence = 
VAR CurrentID= Table1[ID]
VAR CurrentDate = Table1[Modified Date]
RETURN

CALCULATE(
    COUNTROWS( Table1 ),
    FILTER ( 
        ALL( Table1 ),
        CurrentID = Table1[ID]
        && CurrentDate >= Table1[Modified Date]
    )
)

Count using Var.png

 

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Can add this as a calculated column:

Sequence = 
VAR CurrentID= Table1[ID]
VAR CurrentDate = Table1[Modified Date]
RETURN

CALCULATE(
    COUNTROWS( Table1 ),
    FILTER ( 
        ALL( Table1 ),
        CurrentID = Table1[ID]
        && CurrentDate >= Table1[Modified Date]
    )
)

Count using Var.png

 

 

Anonymous
Not applicable

@Anonymous  is there a way to allow duplicate numbers in the sequence? I have a table with multiple rows for the same ID and date and want these to have the same sequence value.

 

Thanks

Anonymous
Not applicable

Works perfect, thanks!

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.