Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi Team,
how to get the index number like this in calculated column using DAX.
I don't need Power Query solution, RANKX also.
the order of coutry should change
| Country | Index |
| Canada | 1 |
| France | 2 |
| Germany | 3 |
| USA | 4 |
| Bermuda | 5 |
Solved! Go to Solution.
Hi @vj123456 ,
You could create a calculated table.
DAX Indexed Table =
VAR __SourceTable = 'Table'
VAR __Count = COUNTROWS(__SourceTable)
VAR __SortText = CONCATENATEX(__SourceTable,[Country],"|")
VAR __Table =
ADDCOLUMNS(
GENERATESERIES(1,__Count,1),
"Country",PATHITEM(__SortText,[Value],TEXT)
)
RETURN
__Table
Reference:
The Mythical DAX Index - Microsoft Power BI Community
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @vj123456 ,
You could create a calculated table.
DAX Indexed Table =
VAR __SourceTable = 'Table'
VAR __Count = COUNTROWS(__SourceTable)
VAR __SortText = CONCATENATEX(__SourceTable,[Country],"|")
VAR __Table =
ADDCOLUMNS(
GENERATESERIES(1,__Count,1),
"Country",PATHITEM(__SortText,[Value],TEXT)
)
RETURN
__Table
Reference:
The Mythical DAX Index - Microsoft Power BI Community
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!