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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
SebaSpotti
Advocate II
Advocate II

Creating an Index Column in a Calculate Table not in alphabetical order

Hi!

I have this calculate table: 

 - Dim_Seniority = DISTINCT(HC[HC Seniority Cluster])
that has those values: 
Cattura.PNG

I want to create another column that index the values in tthe specific order as in picture. This column is needed for ordering some visualizations.

I tried various ways (LOOKUPVALUE, concatened IFs) but i get always an error about "circolar dipendence".

 

Any suggestions?

Thanks,

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@ryan_mayu Thanks for your contribution on this thread.

Hi @SebaSpotti ,

You can update the formula of calculated table [Dim_Seniority] as below:

Dim_Seniority =
ADDCOLUMNS (
    DISTINCT ( HC[HC Seniority Cluster] ),
    "Index",
        SWITCH (
            [HC Seniority Cluster],
            "< 1 year", 1,
            "1 year to 3 years", 2,
            "3 year to 5 years", 3,
            "5 year to 10 years", 4,
            ">= 10 years", 5,
            BLANK ()
        )
)

vyiruanmsft_0-1716528296104.png

Best Regards

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

@ryan_mayu Thanks for your contribution on this thread.

Hi @SebaSpotti ,

You can update the formula of calculated table [Dim_Seniority] as below:

Dim_Seniority =
ADDCOLUMNS (
    DISTINCT ( HC[HC Seniority Cluster] ),
    "Index",
        SWITCH (
            [HC Seniority Cluster],
            "< 1 year", 1,
            "1 year to 3 years", 2,
            "3 year to 5 years", 3,
            "5 year to 10 years", 4,
            ">= 10 years", 5,
            BLANK ()
        )
)

vyiruanmsft_0-1716528296104.png

Best Regards

ryan_mayu
Super User
Super User

have you tried to use SWITCH

 

Column = SWITCH('Table'[HC SeniorityCluster],"< 1 year",1,"1 year to 3 years",2,3)
 
11.PNG
 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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