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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
RAHULBANDI
Helper II
Helper II

Split Columns

Hi

I have Following Data-set

 

DATA

Interim Dividend

Interim Dividend

Interim Dividend

Stock Split

Bouns Issue 8:10

Bouns Issue 1:1

Stock Split

Bonus Issue 2:3

 

Expected Out Put

DATA

Interim Dividend

Interim Dividend

Interim Dividend

Stock Split

Bouns Issue                  8:10

Bouns Issue                  1:1

Stock Split

Bonus Issue                   2:3

 

I would like to split rows which Contain Bonus Issue

 

1 ACCEPTED SOLUTION

@RAHULBANDI 

When you have your table in the following step, click on the Fx button right next to the √ sign which will allow yout add custom step.

Fowmy_0-1661078160908.png

Clear what appears in the next step formula bar and past the following code

=Table.SplitColumn(#"Changed Type", "Interim Dividend", Splitter.SplitTextByCharacterTransition((c) => not List.Contains({"0".."9",":"}, c), {"0".."9"}), {"Interim Dividend.1", "Interim Dividend.2"})


Result

Fowmy_1-1661078264031.png

 



Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

5 REPLIES 5
Fowmy
Super User
Super User

@RAHULBANDI 

In Power Query, add a new colustom column as follows:

if Text.Contains([Interim Dividend],"Bonus Issue") then Text.AfterDelimiter([Interim Dividend], " ", 1) else null,  type text

Fowmy_0-1661073758848.png

 



Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Hi 

thq for your response

8:10, 1:1 etc... have been added to new column 

But I'm looking for

 

Stock Split

Bouns Issue                  8:10

Bouns Issue                  1:1

Stock Split

Bonus Issue                   2:3

 

numerical value completed seperated from text, like above example

 

@RAHULBANDI 

When you have your table in the following step, click on the Fx button right next to the √ sign which will allow yout add custom step.

Fowmy_0-1661078160908.png

Clear what appears in the next step formula bar and past the following code

=Table.SplitColumn(#"Changed Type", "Interim Dividend", Splitter.SplitTextByCharacterTransition((c) => not List.Contains({"0".."9",":"}, c), {"0".."9"}), {"Interim Dividend.1", "Interim Dividend.2"})


Result

Fowmy_1-1661078264031.png

 



Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

RAHULBANDI_0-1661143897319.png

 

 

RAHULBANDI_1-1661143977494.png

 

Hi i have used the above formula with different column name it's showing error

could you please look into it

@RAHULBANDI 

Suppose your data looks like below

Fowmy_0-1661153746032.png

Click on Add Custom Column

Fowmy_1-1661153783250.png

Add the formula as follows:

if Text.Contains([Purpose],"Bonus issue") then "Bonus issue" else [Purpose]

Add one more custom column

if Text.Contains([Purpose],"Bonus issue") then Text.Trim(Text.Replace([Purpose],"Bonus issue","")) else null

Result

Fowmy_2-1661153866552.png

I have given the complete code which you can paste in a new blank query and check

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("rZCxCsIwEIZf5chcQhOpRUerQtc4lg7BRHtQE20Swbe3CJbWImbw1v/j7vuvqghPGScJKaxxtkUlPVoD9gSHRnbakToZkD0a2cIW76i0USAcBZbTtJ8xVRqvO7xMuZSybIpF3BNaheM7LuQVvWzH+caa4ACdCxrYmv1Q5TT/UJg2WcY1WdEsBptv+0PhL69dxAixmbfAc+OhfL2vv7e7BfSPwap+Ag==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Year = _t, Purpose = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Year", Int64.Type}, {"Purpose", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Col1", each if Text.Contains([Purpose],"Bonus issue") then "Bonus issue" else [Purpose]),
    #"Added Custom1" = Table.AddColumn(#"Added Custom", "Col2", each if Text.Contains([Purpose],"Bonus issue") then Text.Trim(Text.Replace([Purpose],"Bonus issue","")) else null)
in
    #"Added Custom1"



 





 



 



Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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