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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
anbose
Frequent Visitor

count number of lines and separate them into two columns

Hii, I'm new to powerbi. For the below table, for each cutomer Id, I want to split the "Alerts" column into two columns based on position of the line. The odd ones should get stored into Alerts1 and even ones into Alerts2. I'm not able to do this. Can anyone help me with this. Thank you.

anbose_0-1685887428607.png

 

1 ACCEPTED SOLUTION

=Table.SplitColumn(PreviousStepName,"Alers",each List.Transform(List.Zip(List.Split(Text.Split(_,"#(lf)"),2)),each Text.Combine(_,"#(lf)")),{"Alerts1","Alerts2"})

View solution in original post

4 REPLIES 4
wdx223_Daniel
Super User
Super User

=Table.SplitColumn(PreviousStepName,"Alers",each List.Transform(List.Zip(List.Split(Text.Split(_,"#(lf)"),2)),eacth Text.Combine(_,"#(lf)"),{"Alerts1","Alerts2"})

Hii, Thanks for your reply. After applying this formula, I'm getting this below error.
Expression.Error: 3 arguments were passed to a function which expects 2.
Details:
Pattern=
Arguments=[List]
Can you please tell me why it is coming? Thank you

=Table.SplitColumn(PreviousStepName,"Alers",each List.Transform(List.Zip(List.Split(Text.Split(_,"#(lf)"),2)),each Text.Combine(_,"#(lf)")),{"Alerts1","Alerts2"})

Thank you so much. It worked.

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.