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
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
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.

Top Solution Authors