Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreThe FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now
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.
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.
The following calculated column should work
NameRank =
RANKX(
DISTINCT('Table'[Name]),
CALCULATE(MIN('Table'[Name])),
, ASC, DENSE
)
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.
In M group by the name (and keep the rows), add an index column, and then expand the rows back out.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 52 | |
| 39 | |
| 37 | |
| 19 | |
| 18 |
| User | Count |
|---|---|
| 67 | |
| 66 | |
| 34 | |
| 32 | |
| 29 |