cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
THEG72
Helper V
Helper V

Add Index Column which is repeated based on Group by Text field

Hi am looking to have an Index Column that will repeat the same index number if the AccoutantLinkCode is repeated in another text field column.

 

So for the first AccountantLinkCode group "Bank" the index would be 1, then next group AR would be 2 and so on..

 

Can you advise the best approach or function to get this new index column in the table below?

 

Index.PNG

1 ACCEPTED SOLUTION

@THEG72

 

Please see the Query Editor in attached PBIX file

 

 


Regards
Zubair

Please try my custom visuals

View solution in original post

6 REPLIES 6
Zubair_Muhammad
Community Champion
Community Champion

HI @THEG72

 

Try this. First Add a supporting Column

 

Supporting Column =
CALCULATE (
    MIN ( Table1[Index] ),
    ALLEXCEPT ( Table1, Table1[AccountantLinkCode] )
)

Regards
Zubair

Please try my custom visuals

@THEG72

 

Then you can use this Index Column

Please see attached excel file

 

 

Index Column =
RANKX ( Table1, Table1[SupportingColumn],, ASC, DENSE )

 

 

indexed4.png

 


Regards
Zubair

Please try my custom visuals

@Zubair_Muhammad

Thanks for your reply, would you know the M language version to get this result instead of DAX? 

Hi @THEG72

 

With Query Editor...You can create a Duplicate Query....

Summarize(Group by) results using the AccountantLinkCode Column
Then Add an Index to it

 

M.png


Regards
Zubair

Please try my custom visuals

@THEG72

 

Now you can merge the 2 Queries

 

M2.png

 

 

 

Result

 

M3.png

 


Regards
Zubair

Please try my custom visuals

@THEG72

 

Please see the Query Editor in attached PBIX file

 

 


Regards
Zubair

Please try my custom visuals

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

Thank you 2022 Review

2022 Monthly Feature Releases

We had a great 2022 with a ton of feature releases to help you drive a data culture.