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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
potatodog123
Frequent Visitor

Power Query: Formatting with special Line Breaks/Delimiter

Hi, I'm trying to import activity logs of a certain application to visualize errors. The logs are not very data-analytics friendly. It is essentially a text file thats formatted like this:

05/15/2022 11:32 AM: Success.
05/15/2022 11:45 AM: ERROR: in process4
   in: line number 4
   in: line number 8
05/15/2022 11:48 AM: Success.
07/15/2022 9:02 AM: Success.
07/15/2022 9:15 AM: ERROR: in process6
   in: line number 102
   in: line number 200
   in: line number 830
07/15/2022 12:49 PM: Success.

etc...
I imported the text file as CSV and formated the dataset in power query, but I'm struggling find a line break/delimiter so that each log (based on time) is 1 entry.

What I'm getting is (using tab as Delimiter)

05/15/2022 11:32 AM: Success.
05/15/2022 11:45 AM: ERROR: in process4
   in: line number 4
   in: line number 8
05/15/2022 11:48 AM: Success.


I want it to look like:

05/15/2022 11:32 AM: Success.
05/15/2022 11:45 AM: ERROR: in process4
   in: line number 4
   in: line number 8
05/15/2022 11:48 AM: Success.




1 ACCEPTED SOLUTION
v-luwang-msft
Community Support
Community Support

Hi @potatodog123 ,

Pls test the below:

Add index:

vluwangmsft_0-1649732773997.png

Then use the below dax to create new column:

test = if(LEFT(test1[Column1],1)=" ",0,test1[Index])
maxindex = CALCULATE(MAX(test1[Index]),FILTER(ALL(test1),test1[test]<>0&&test1[Index]<=EARLIER(test1[Index])))

Final create a new table:

Table = SUMMARIZE (
    'test1',test1[maxindex],
     "newcolumn", CONCATENATEX ( VALUES ( 'test1'[Column1]), [Column1],UNICHAR(10))
)

After research, when we add line break in text directly, Power BI always strips line breaks out of text when it gets loaded into the Data Model.So we need to create visual 😞Please review more details about UNICHAR in this blog.)

vluwangmsft_1-1649733059841.png

 


Best Regards

Lucien

View solution in original post

3 REPLIES 3
v-luwang-msft
Community Support
Community Support

Hi @potatodog123 ,

Pls test the below:

Add index:

vluwangmsft_0-1649732773997.png

Then use the below dax to create new column:

test = if(LEFT(test1[Column1],1)=" ",0,test1[Index])
maxindex = CALCULATE(MAX(test1[Index]),FILTER(ALL(test1),test1[test]<>0&&test1[Index]<=EARLIER(test1[Index])))

Final create a new table:

Table = SUMMARIZE (
    'test1',test1[maxindex],
     "newcolumn", CONCATENATEX ( VALUES ( 'test1'[Column1]), [Column1],UNICHAR(10))
)

After research, when we add line break in text directly, Power BI always strips line breaks out of text when it gets loaded into the Data Model.So we need to create visual 😞Please review more details about UNICHAR in this blog.)

vluwangmsft_1-1649733059841.png

 


Best Regards

Lucien

v-luwang-msft
Community Support
Community Support

Hi @potatodog123 ,

What is the difference between the results you are currently getting and the results you would like to get? So far based on what you have provided, it seems to me that both are the same.

vluwangmsft_0-1649658633203.png

 

Best Regards

Lucien

Hi, in the example: I'm getting 5 rows of data, I want to have 3 rows in that case.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.