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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
rksharma86
Frequent Visitor

Having trouble with transforming data from a table with similar multiple columns

Background: I have a table which contains the code breach incidents of banks. Each line represents a incident, along with cause of incident, identification, remediation and corrective action, customer impact and financial impact as below.

 

BankRef_Key(PK)Incident DescriptionCauseIdentification MethodRemediationCorrective ActionCustomer ImpactFinancial impactCode chapter breached (1)No of breaches of Code chapter (1) Code chapter breached (2)Number of breaches of code chapter (2)Code chapter breached (3)Number of breaches of code chapter (3)
Bank A1Free text field(abc, xyz)HumanComplaintsReimbursmentCoaching1500Chapter 21Chapter 101  
Bank A2Free text field(abc, xyz)SystemCustomerApologysystem fix5000780000Chapter 510    
Bank C3Free text field(abc, xyz)HumanInternal AuditNot necessaryCoaching5779981Chapter 65Chapter 91Chapter 31
Bank C4Free text field(abc, xyz)third partyComplaintsNot necessaryTraining815151Chapter 71    
Bank B5Free text field(abc, xyz)SystemCustomerRefundsystem fix9911451151Chapter 92Chapter 21  

 

  1. Each incident can have one or more than one breach of the code. Breaches are identified in multiple columns of the same incidents.
  2. Due to the table design, we have an issue with identifying the sum of breaches of a particular chapter or part. Code Chapter is a dimension table as below example-
    part_idchapter_id
    Part 101
    Part 102
    Part 203
    Part 204
    Part 205
    Part 206
    Part 207
    Part 308
    Part 309
    Part 310
    Part 311
    Part 312
    Part 413
    Part 414
    Problem to Solve: I want to combine the multiple columns of code chapter and no of breaches so that, code chapter in one column and no of breaches in another column identified by the Ref_Key as below, which will make it easier to aggregate the breaches and apply filter on the code chapter
    Ref_KeyCode chapter breachedNo of breaches
    1Chapter 21
    1Chapter 101
    2Chapter 510
    3Chapter 65
    3Chapter 91
    3Chapter 31
    4Chapter 71
    5Chapter 92
    5Chapter 21
    Thanks in advance 🙂
1 ACCEPTED SOLUTION
wdx223_Daniel
Super User
Super User

NewStep= #table({"Ref_ID","Code chapter breached","No of breaches"},List.TransformMany(Table.ToRows(PreviousStepName),each List.Select(List.Split(List.Skip(_,9),2),each Text.Trim(_{0}??"")<>""),(x,y)=>{x{1}}&y))

View solution in original post

2 REPLIES 2
wdx223_Daniel
Super User
Super User

NewStep= #table({"Ref_ID","Code chapter breached","No of breaches"},List.TransformMany(Table.ToRows(PreviousStepName),each List.Select(List.Split(List.Skip(_,9),2),each Text.Trim(_{0}??"")<>""),(x,y)=>{x{1}}&y))

Thanks, I appreacite it very much! It worked worked like a charm. Honestly speaking I am having a little difficulty to understand the step (way outside of my current knowledge of M)

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors