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
hackfifi
Helper V
Helper V

Add Index based on 2 x Columns

Hi - Just need some help to create the INDEX column. It should be a sequence number sorted on Period but resets when Project Changes. Happy to use a calculated column or adding it to the Power Query table. Thanks!! 

 

ProjectPeriodIndex
AJan-201
AFeb-202
AMar-203
AApr-204
AMay-205
BMar-201
BApr-202
BMay-203
BJun-204
CApr-211
CMay-212
CJun-213
CJul-214
1 ACCEPTED SOLUTION

Hi @hackfifi ,

 

Would you please try to use 

 

 

Index = RANKX(filter('Table','Table'[Project]=earlier('Table'[Project])),'Table'[Period],,ASC,Dense)

 

 

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

 

Best Regards,

Dedmon Dai

 

View solution in original post

5 REPLIES 5
az38
Community Champion
Community Champion

hi @hackfifi 

try a RANKX() column

Index = 
    RANKX(
        FILTER(
                'Table',
                'Table'[Project]=EARLIER('Table'[Project])
                ),
        'Table'[Period],,
        ASC
        )

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Hi @az38  - Thanks for respondng. but it did not work. I filtered on 1 Project, But the index column is giving me random values

Index = RANKX(filter('Table','Table'[Project]=earlier('Table'[Project])),'Table'[Period],,ASC)

 

Index.PNG

 

az38
Community Champion
Community Champion

@hackfifi 

yes, you need to define tie-break rule for the one date - one project rows


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

So the tie break rule is when the project changes, the index resets. So what am i doing wrong? 🙂

Hi @hackfifi ,

 

Would you please try to use 

 

 

Index = RANKX(filter('Table','Table'[Project]=earlier('Table'[Project])),'Table'[Period],,ASC,Dense)

 

 

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

 

Best Regards,

Dedmon Dai

 

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.