- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Create A Calculated Column With Number for Unique Text
Hi,
I have hundred of names and I need to create numbers to represent each of them as shown
Are there DAX or M Code I can use?
Thanks...tksnota01...
A 1
B 2
C 3
D 4
B 2
D 4
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

In Power Query make a copy of your existing table and remove all the columns except the name. Remove duplicate values then add an index column, then use Merge as new to merge the original query with the list of unique names. Expand the merged table to bring in the index column.
Finally, you can untick the Enable Load option for the original query and the unique names, so only the merged table is pulled into your model.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

The following calculated column should work
NameRank =
RANKX(
DISTINCT('Table'[Name]),
CALCULATE(MIN('Table'[Name])),
, ASC, DENSE
)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

In Power Query make a copy of your existing table and remove all the columns except the name. Remove duplicate values then add an index column, then use Merge as new to merge the original query with the list of unique names. Expand the merged table to bring in the index column.
Finally, you can untick the Enable Load option for the original query and the unique names, so only the merged table is pulled into your model.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

In M group by the name (and keep the rows), add an index column, and then expand the rows back out.

Helpful resources
Subject | Author | Posted | |
---|---|---|---|
05-15-2024 11:29 AM | |||
Anonymous
| 03-07-2024 08:14 AM | ||
07-17-2024 10:59 AM | |||
07-15-2024 07:05 AM | |||
06-11-2024 06:30 AM |
User | Count |
---|---|
122 | |
107 | |
85 | |
52 | |
46 |