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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Split Column by Delimiter-by using different value condition

Hi All,

 

I have data like below table i want to "Split Column by Delimiter"  by using different value condition

Ex:

If Category = UPI then Split by "/" & first three value 

If Category = NEFT then Split by "-" & last value 

If Category = Charges then Split by ": " & last value 

 

Screenshot_13.png

 

Data:

CategoryInput
UPIUPI/02451574525388/15:09:43/UPI/YYYYYY
UPIUPI/02451457297497/14:50:49/UPI/XXXXXX
NEFTNEFT-282414563872-AAAAAAA
NEFTNEFT-206721296-BBBBBB
ChargesCharges for PORD Customer Payment :460297250
ChargesCharges for PORD Customer Payment :460297244

 

Thanks,

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@Anonymous 

Paste the below code in the Advanced Editor of a Blank Query and check the step:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("nY49D4IwEIb/CuksaTnuWtpNURMWJUYTDWFgqLgAho+Bf2+pbjr5DPeRe5/kioKl1Wjrrp/ZimXtcxpZuSrYJc/c7ioXgBSRQgKKk4RHZIQ2GPPldvP8EpAUaIVa8QgNCYPaC1ePFw67/dkZSwshAXSKjBMF4frNd0hIBRFoGW48PpA+qr62g8t8puDe9UF+PG2DdBrGrrFuq+bGtmNgUAr3FJD4W0VkZfkC", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"(blank)" = _t, #"(blank).1" = _t]),
    #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
    AddColumn = Table.AddColumn(#"Promoted Headers", "Extracted", each 
    if [Category] = "UPI" then
    Text.BeforeDelimiter([Input], "/", {1, RelativePosition.FromEnd}) else if [Category] = "NEFT" then
    Text.AfterDelimiter([Input], "-", 1) else if [Category] = "Charges" then
    Text.AfterDelimiter([Input], ":") else null)
in
   AddColumn

Fowmy_0-1604318490581.png

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

 




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

2 REPLIES 2
Fowmy
Super User
Super User

@Anonymous 

Paste the below code in the Advanced Editor of a Blank Query and check the step:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("nY49D4IwEIb/CuksaTnuWtpNURMWJUYTDWFgqLgAho+Bf2+pbjr5DPeRe5/kioKl1Wjrrp/ZimXtcxpZuSrYJc/c7ioXgBSRQgKKk4RHZIQ2GPPldvP8EpAUaIVa8QgNCYPaC1ePFw67/dkZSwshAXSKjBMF4frNd0hIBRFoGW48PpA+qr62g8t8puDe9UF+PG2DdBrGrrFuq+bGtmNgUAr3FJD4W0VkZfkC", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"(blank)" = _t, #"(blank).1" = _t]),
    #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
    AddColumn = Table.AddColumn(#"Promoted Headers", "Extracted", each 
    if [Category] = "UPI" then
    Text.BeforeDelimiter([Input], "/", {1, RelativePosition.FromEnd}) else if [Category] = "NEFT" then
    Text.AfterDelimiter([Input], "-", 1) else if [Category] = "Charges" then
    Text.AfterDelimiter([Input], ":") else null)
in
   AddColumn

Fowmy_0-1604318490581.png

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

 




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

amitchandak
Super User
Super User

@Anonymous , One way is to replace - and: by / and then use split

https://www.howtoexcel.org/power-query/bulk-replace-values/

https://www.tutorialgateway.org/how-to-split-columns-in-power-bi/

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.