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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
BalazsNy
Helper I
Helper I

Dynamic index column based on alphabetical order or values of a column (name)

Hi All,

I have a report which contains a table including different employee data & I would like to add a dynamic index column based on the alphabetical order of emlpoyee names. However, I would like the index column to be dynamic based on all the selected filters so that it would always start from 1 & not keeping the original (unfiltered) index number.

 

Example:

Screenshot 2025-07-25 171955.png

 

Could you advice any solution / DAX formula to solve this issue?

Thanks in advance.

2 ACCEPTED SOLUTIONS
ABA007
Regular Visitor

Hi, 
I suggest that you use a measure for that : 
1- First create a Mesure 
Dynamic Index = 
RANKX(
ALLSELECTED(Employee),

Employee[name], ASC,DENSE

)

 

DENSE here ensure no gap between numbers.
2- Add it to your table visual

3- sort by Dynamic Index

Hope this would help

Best! 

 

View solution in original post

MFelix
Super User
Super User

Hi @BalazsNy ,

 

Currently the best option is to use visual calculations follow these steps:

  • On your table click the New Visual calculation button

MFelix_0-1753461015269.png

  • Add a field called ID = 1

MFelix_1-1753461050437.png

 

  • Add a second field running some of ID (rename it to whatever you want)

MFelix_2-1753461077504.png

 

What is good about this approach is that the order is always the same no matter what column you select to sort your values

 

 

  • Hide the ID column

MFelix_3-1753461113195.png

MFelix_4-1753461224672.png

 

MFelix_5-1753461238584.pngMFelix_6-1753461247797.png

Check documentation below:

https://learn.microsoft.com/en-us/power-bi/transform-model/desktop-visual-calculations-overview

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

6 REPLIES 6
v-ssriganesh
Community Support
Community Support

Hello @BalazsNy

Could you please confirm if your query has been resolved by the provided solutions? This would be helpful for other members who may encounter similar issues.

 

Thank you for being part of the Microsoft Fabric Community.

v-ssriganesh
Community Support
Community Support

Hello @BalazsNy,

Hope everything’s going great with you. Just checking in has the issue been resolved or are you still running into problems? Sharing an update can really help others facing the same thing.

Thank you.

v-ssriganesh
Community Support
Community Support

Hello @BalazsNy,

We hope you're doing well. Could you please confirm whether your issue has been resolved or if you're still facing challenges? Your update will be valuable to the community and may assist others with similar concerns.

Thank you.

v-ssriganesh
Community Support
Community Support

Hello @BalazsNy,
Thank you for reaching out to the Microsoft Fabric Community Forum.

I have reproduced your scenario using a sample employee table and got the expected output using a DAX measure. The dynamic index resets based on filters and orders alphabetically by employee name.

Here’s the DAX measure I used:

Dynamic Index =

VAR CurrentEmployee = SELECTEDVALUE(Employees[employee])

RETURN

    RANKX(

        FILTER(

            ALLSELECTED(Employees),

            NOT(ISBLANK(Employees[employee]))

        ),

        Employees[employee],

        CurrentEmployee,

        ASC,

        DENSE

    )

Please ensure you place this in a Table visual and sort by employee ascending. Add slicers like market and status to dynamically control your view.

vssriganesh_0-1753679363996.png

 

For your reference, I’ve attached a sample .pbix file and thanks @MFelix & @ABA007 for sharing your valuable insights.

Best Regards,
Ganesh Singamshetty.

MFelix
Super User
Super User

Hi @BalazsNy ,

 

Currently the best option is to use visual calculations follow these steps:

  • On your table click the New Visual calculation button

MFelix_0-1753461015269.png

  • Add a field called ID = 1

MFelix_1-1753461050437.png

 

  • Add a second field running some of ID (rename it to whatever you want)

MFelix_2-1753461077504.png

 

What is good about this approach is that the order is always the same no matter what column you select to sort your values

 

 

  • Hide the ID column

MFelix_3-1753461113195.png

MFelix_4-1753461224672.png

 

MFelix_5-1753461238584.pngMFelix_6-1753461247797.png

Check documentation below:

https://learn.microsoft.com/en-us/power-bi/transform-model/desktop-visual-calculations-overview

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



ABA007
Regular Visitor

Hi, 
I suggest that you use a measure for that : 
1- First create a Mesure 
Dynamic Index = 
RANKX(
ALLSELECTED(Employee),

Employee[name], ASC,DENSE

)

 

DENSE here ensure no gap between numbers.
2- Add it to your table visual

3- sort by Dynamic Index

Hope this would help

Best! 

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.