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! Request now

Reply
Mateusz00
Frequent Visitor

Index / Rank

Hello, I have three columns (ID, Time and Status). I would like to have some calculated column which shows me for each ID index / rank until the status is "Closed" (based on time column).

ID                Time                 Status           Index

1                 01/01/2023       Other            1

1                 02/01/2023       Closed          1

1                 03/01/2023       Other            2

1                 04/01/2023       Other            2

1                 05/01/2023       Other            2

1                 06/01/2023       Closed          2
1                 07/01/2023       Other            3

2                 06/01/2023       Other            1
2                 07/01/2023       Closed          1

2                 08/01/2023       Other            2

2                 09/01/2023       Other            2

2               10/01/2023       Closed            2

1 ACCEPTED SOLUTION

hi, @Mateusz00 

try below code 

RANKX(
    FILTER(
        'Table','Table'[id]=EARLIER('Table'[id]) &&
        'Table'[time]<=EARLIER('Table'[time])&&
        'Table'[status]="closed"
    ),
    'Table'[time],,ASC,Dense
)

 

Dangar332_0-1705474451036.png

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi, @Mateusz00 

Based on the information you have provided, Here are my answers to your questions.

1. Create a table of your presentation.

vyilongmsft_0-1705458279371.png

 

2. Create a calculated column, enter the appropriate DAX code and filter out the Index with Status of Closed.

Column =

    VAR currentID = 'Table'[ID]

    VAR currentStatus = 'Table'[Status]

RETURN

IF(currentStatus = "Closed",

    RANKX(

        FILTER('Table', 'Table'[ID] = currentID && 'Table'[Time] <= EARLIER('Table'[Time]) && 'Table'[Status] = "Closed"),

        'Table'[Time],

        ,

        ASC,

        DENSE

    ),

    BLANK()

)

vyilongmsft_1-1705458333997.png

 

 

 

How to Get Your Question Answered Quickly 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello, thank you for your response but how can we complete each rows? (in this formula we have blanks and I must have data exactly like in my Index column from the sample).

hi, @Mateusz00 

try below code 

RANKX(
    FILTER(
        'Table','Table'[id]=EARLIER('Table'[id]) &&
        'Table'[time]<=EARLIER('Table'[time])&&
        'Table'[status]="closed"
    ),
    'Table'[time],,ASC,Dense
)

 

Dangar332_0-1705474451036.png

 

Mateusz00
Frequent Visitor

Topic got to the spam folder earlier. Can somebody helps me?

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.