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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
wi11iamr
Advocate II
Advocate II

Replace carriage return in dataset

Hi there,

 

I have some columns in my dataset that has a large amount of text that includes a carriage return for some records.

 

Does anyone know of some interesting techniques I could try to replace the carriage return with a comma?

 

Thanks

W

1 ACCEPTED SOLUTION
Seth_C_Bauer
Community Champion
Community Champion

@wi11iamr It would appear you can do this in the Desktop.

In the Data section, click "Edit Queries" in the ribbon.

Select the table you want, and right click the column header

Select "Replace Values", click in the "Value To Find"

Select "Advanced Options" check "Replace using special characters"

Select "Insert special character"

Click "Carriage Return" and a carriage return should show in your values section

put comma in "Replace With"

OK

Close and Apply

 

This is "in theory" as I didn't directly test it, but the sequence appears to support the action.


Looking for more Power BI tips, tricks & tools? Check out PowerBI.tips the site I co-own with Mike Carlo. Also, if you are near SE WI? Join our PUG Milwaukee Brew City PUG

View solution in original post

5 REPLIES 5
aggregator3000
Advocate II
Advocate II

Bumping this old one for anyone wanting to do this in DAX.
Note, Line feed and Carriage Return are different to eachother.
I only know this after dealing with a string that had both... yep


You can use either of following, or combine them

 

Substitute out the carriage = 
    SUBSTITUTE( [TestCarriage],
                unichar(13),
                "\") --Replacement here

Substitute out the Line Feed = 
    SUBSTITUTE( [TestLineFeed],
                unichar(10),
                "\") --Replacement here

 

Seth_C_Bauer
Community Champion
Community Champion

@wi11iamr It would appear you can do this in the Desktop.

In the Data section, click "Edit Queries" in the ribbon.

Select the table you want, and right click the column header

Select "Replace Values", click in the "Value To Find"

Select "Advanced Options" check "Replace using special characters"

Select "Insert special character"

Click "Carriage Return" and a carriage return should show in your values section

put comma in "Replace With"

OK

Close and Apply

 

This is "in theory" as I didn't directly test it, but the sequence appears to support the action.


Looking for more Power BI tips, tricks & tools? Check out PowerBI.tips the site I co-own with Mike Carlo. Also, if you are near SE WI? Join our PUG Milwaukee Brew City PUG

Thanks Eno, the solution you propose is however unfortunately to replace characters with a carriage return. My dilemma is to replace a carriage return with a character.

Anonymous
Not applicable

@wi11iamr

 

i think @Seth_C_Bauer solution should work for replacing with a character 

below image did that when i have it for line feed and replaced it with '-'

 

Replace.PNG

After

 

Replace After.PNG

Thank you, it appears I was too hasty (and naieve) in my initial response.

 

@Seth_C_Bauer - your clarification was indeed correct, thank you.

@Anonymous - thank you for taking the time to point this out to me

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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