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
nhutruong
Frequent Visitor

How to add a column with sequence ranking the appearance of a cell?

Hi All,

 

I know the way I way I phrase the question is very weird but I do not know how to describe what I need, so below is an example of what I have.

 

Issue :

 

The below is a column I have

Product CodeEvent Time
A1/1/2022
B1/1/2022
C1/1/2022
A2/1/2022
B2/1/2022
C2/1/2022
A3/1/2022
B3/1/2022
C3/1/2022

 

I need to add a column to specify the sequence of the moves according to event time for each product code.

I would need something looks like this:

 

Product CodeEvent TimeSequence
A1/1/20221
B1/1/20221
C1/1/20221
A2/1/20222
B2/1/20222
C2/1/20222
A3/1/20223
B3/1/20223
C3/1/20223

 

I think I need to use the summarize function but I am unfortunately not proficient enough to make out the formula on my own,

I would appreciate any help.

 

Thank you so much.

 

Regards.

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

It is for creating a new column.

 

Jihwan_Kim_0-1679459762101.png

 

 

Sequence CC =
COUNTROWS (
    WINDOW (
        1,
        ABS,
        0,
        REL,
        SUMMARIZE ( ALL ( Data ), Data[Product Code], Data[Event Time] ),
        ORDERBY ( Data[Event Time], ASC ),
        KEEP,
        PARTITIONBY ( Data[Product Code] )
    )
)

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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

It is for creating a new column.

 

Jihwan_Kim_0-1679459762101.png

 

 

Sequence CC =
COUNTROWS (
    WINDOW (
        1,
        ABS,
        0,
        REL,
        SUMMARIZE ( ALL ( Data ), Data[Product Code], Data[Event Time] ),
        ORDERBY ( Data[Event Time], ASC ),
        KEEP,
        PARTITIONBY ( Data[Product Code] )
    )
)

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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

OMG, thank you so much for your fast response.

Worked like a charm.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

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

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.