Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Roodakker
Frequent Visitor

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.

 

Roodakker_0-1698310034995.png

 

 

Is it possible to solve my problem? 

 

1 ACCEPTED SOLUTION
v-xinruzhu-msft
Community Support
Community Support

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.

 

 

 

View solution in original post

2 REPLIES 2
v-xinruzhu-msft
Community Support
Community Support

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.

 

 

 

lbendlin
Super User
Super User

 the second use of the status

M 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-...
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/1447...

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors