Forum Discussion
saddlerkayla
10 months agoRegular Visitor
Convert Dax to M Code
I am trying to convert this DAX to M Code. I created a custom column with this DAX in the table view but I want to create this column in the Power Query editor. Please help! Unique Product = VA...
- 10 months ago
Hello! This issue was resolved. I ended up being able to work it out with a simple index column. Thank you all so much!
jgeddes
10 months agoSuper User
Consider example data...
You can get this result with the following code...
= Table.AddColumn(YourPreviousStep, "Unique Product", each let ranking = Table.RowCount(Table.SelectRows(YourPreviousStep, (r)=> [Product Name] = r[Product Name] and [Index] <= r[Index])) in if ranking > 1 then [Product Name] & " " & Number.ToText(ranking) else [Product Name], type text)
This should get you pointed in the right direction.