Forum Discussion
Change name on duplicates in the same ID
Hi, I'm a rookie at M and need help!
I'm preparing data for process mining and unfortunatley the process use the same status "14 - Approved" multiple times per ID. If possible, it would be great if I somehow could rename the second use of the status per ID to "14 - ODD Approved".
I've tried this M-formula to create a count of status 14 and based on the occurance rename the second one.
let
Source = Excel.CurrentWorkbook [Content],
Custom = Table.Group(Source, {"Efecte ID", "[StatusHistoryRefined;14KYCApproved]"}, {{"Count", each Table.RowCount(_), type number}}),
AddedCustom = Table.AddColumn(Custom, "New Status", each if [Count] > 1 and [Count] = 2 then "14 - ODD KYC Approved" else [StatusHistoryRefined;14KYCApproved]),
RemovedColumns = Table.RemoveColumns(AddedCustom, {"Count", "[StatusHistoryRefined;14KYCApproved]"}),
ExpandCustom = Table.ExpandTableColumn(RemovedColumns, "New Status", {"Efecte ID", "New Status"})
in
ExpandCustom
But it won't recognize [StatusHistoryRefined;14KYCApproved] as identifier.
Is it possible to solve my problem?
- Anonymous2 years ago
Hi Roodakker
1.You can consider to add an index column group by each id first , the step can refer to the following link.
Create Row Number for Each Group in Power BI using Power Query - RADACAD
2.Then add a custom column
e.g(Then [Index] column is the one you have created above.
if [Index]=2 then "14 - ODD KYC Approved" else [StatusHistoryRefined;14KYCApproved]Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- lbendlinSuper User
the second use of the statusM has no idea what you mean by that. You need to introduce an index column.
Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue.
If you are unsure how to do that please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216
Please show the expected outcome based on the sample data you provided.
If you want to get answers faster please refer to https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523 - AnonymousNot applicable
Hi Roodakker
1.You can consider to add an index column group by each id first , the step can refer to the following link.
Create Row Number for Each Group in Power BI using Power Query - RADACAD
2.Then add a custom column
e.g(Then [Index] column is the one you have created above.
if [Index]=2 then "14 - ODD KYC Approved" else [StatusHistoryRefined;14KYCApproved]Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.