Forum Discussion
saddlerkayla
1 year 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...
- 1 year 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
Super User
1 year agoConsider 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.