• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

Rows into Columns, and Combine Rows with Tricky Structure|Power Query|Excel Forum|My Online Training Hub

You are here: Home / Rows into Columns, and Combine Rows with Tricky Structure|Power Query|Excel Forum|My Online Training Hub
Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search|Last Search Results
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumPower QueryRows into Columns, and Combine Rows…
sp_PrintTopic sp_TopicIcon
Rows into Columns, and Combine Rows with Tricky Structure
Avatar
Todd Itami

Active Member
Members
Level 0
Forum Posts: 3
Member Since:
March 23, 2019
sp_UserOfflineSmall Offline
1
March 23, 2019 - 11:01 am
sp_Permalink sp_Print

Hi,

I have text that was output from a database at some point that I would like to get into tabular format using powerquery. I have two problems that I can't seem to get around:

(1) the text is in linear format with the field name, a tab, and then the field value---how do I get that into columns?

(2) Here's the tricky part, the "post_text" tag is strangely mixed up in it's own field values. Fortunately the field value is contained by special characters "Œ".  What makes this especially challenging, as you will see in the sample below, the text strangely breaks rows idiosyncratically.  In other words, the values for the "post_text" column for the three records below would be:

"There is an issue with the back side fuse post_text box that is misbehaving"
"Port side copling no long tight around back side H joint, must change post_text out looped bolt"
"Back side power relay also failing based on meter readings and power flow indicator"

Any ideas?  Sample data below.

 

Œticket_doc	 738473
created_date	 8/20/2011
post_id	 235051 
post_date	 8/20/2011
problem_type	 Electrical
ticket_owner_user	 John James 
ticket_ owner_ contact	 j@jay.com
Œ	
There is an issue with the back side fuse
post_text box that is misbehaving
Œticket_doc	 738422
created_date	 8/20/2011
post_id	 235051 
post_date	 8/20/2011
problem_type	 Mechanical
ticket_owner_user	 John James 
ticket_ owner_ contact	 j@jay.com
Œ	
Port side copling no long tight around back side H joint, must change
post_text out looped bolt
Œticket_doc	 738413
created_date	 2/20/2013
post_id	 235051 
post_date	 2/20/2012
problem_type	 Electrical
ticket_owner_user	 John James 
ticket_ owner_ contact	 j@jay.com
Œ	
Back side power relay also failing
based on meter readings and 
power flow indicator
Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1807
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
2
March 25, 2019 - 2:17 pm
sp_Permalink sp_Print

Hi Todd,

Can you please upload a sample text file as it is exported from that database? Pasted data in browser will alter the data, the browser is converting some chars into html formats.

Avatar
Todd Itami

Active Member
Members
Level 0
Forum Posts: 3
Member Since:
March 23, 2019
sp_UserOfflineSmall Offline
3
March 27, 2019 - 1:26 pm
sp_Permalink sp_Print sp_EditHistory

I apologize. Please see attached. And thank you!

Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1807
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
4
March 27, 2019 - 11:12 pm
sp_Permalink sp_Print

Hi Todd,

Before each group, there is a description like:

"

There is an issue with the back side fuse
post_text box that is misbehaving

"

This example description is split over 2 rows, while the last one is split over 3 rows. Because the data is not in a single row as expected, and it's not even in a fixed number of rows, makes things more complicated. If we remove descriptions, things are much easier, see the attached file.

Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1807
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
5
March 27, 2019 - 11:28 pm
sp_Permalink sp_Print sp_EditHistory

Descriptions needs to be combined into a single line of text in this case.

This can be done fairly easy, by filling down the ticket doc ID to all rows, keep only descriptions then group and join the text with the same ID.

Last step will be to merge the description with the previous table, using the ID and the lookup key.

Sample attached.

Avatar
Todd Itami

Active Member
Members
Level 0
Forum Posts: 3
Member Since:
March 23, 2019
sp_UserOfflineSmall Offline
6
March 31, 2019 - 4:33 am
sp_Permalink sp_Print

Thank you very much for your generous help!  I'm running into an error with the "filled up" step. I'm using your example file, and the only thing I changed was the text source. Any idea?

Thank you again.Error.PNGImage Enlarger

sp_PlupAttachments Attachments
  • sp_PlupImage Error.PNG (209 KB)
Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1807
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
7
March 31, 2019 - 1:53 pm
sp_Permalink sp_Print sp_EditHistory

Take a look at the previous step, just above Filled Up step. There should be a column named "ticket_doc", the next step query says it cannot find that column.

Originally, you had "Œticket_doc", make sure that symbol is eliminated at Replaced Value step, otherwise you will have to check what symbol you have there and remove it.

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Ruth Savage, Andy Kirby, Roy Lutke, Jeff Krueger
Guest(s) 7
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 870
Purfleet: 412
Frans Visser: 346
David_Ng: 306
lea cohen: 219
A.Maurizio: 202
Jessica Stewart: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
John Chisholm
vexokeb sdfg
John Jack
Malcolm Toy
Ray-Yu Yang
George Shihadeh
Naomi Rumble
Uwe von Gostomski
Jonathan Jones
drsven
Forum Stats:
Groups: 3
Forums: 24
Topics: 6212
Posts: 27236

 

Member Stats:
Guest Posters: 49
Members: 31889
Moderators: 3
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.