Forum

Notifications
Clear all

Translating a list of patients with multiple lines to one line each with all data across the page

3 Posts
2 Users
0 Reactions
62 Views
(@leeanne)
Posts: 2
New Member
Topic starter
 

Hi,

I'm new here and am having trouble seeing if this question has been raised before.  I'm having trouble even describing what I am trying to do.

I am wanting to find a way to take a table which lists patients and every diagnosis they have with one diagnosis per line meaning that some patients have lots and lots of lines and transforming it to one line per patient with all the diagnoses listed from left to right after the patient details in the appropriate order for the diagnosis.

I have attached an example of what I mean.  The table on the left is the starting data with the two grey columns either side added to enable me to transform the data into the table on the right. The initial data is first sorted into the correct order for the diagnoses for each patient and the Order column is added in indicate the correct order.  the concat() column is then added at the far left of the table to enable a vlookup to work in the second table.

All suggestions gratefully accepted 🙂

Thanks you

Leeanne

 
Posted : 06/02/2019 5:29 pm
(@catalinb)
Posts: 1937
Member Admin
 

Hi Leeanne,

It can be done, but I don't see any reason for this transformation, you have the data already in a proper tabular format. All you have to do is to add a pivot table that can help visualizing data in a different structure., More, you can sort the pivot by the columns you want.

In the file attached, I added a query to reformat your sample data and 2 pivot tables based on your original data.

 
Posted : 07/02/2019 12:28 am
(@leeanne)
Posts: 2
New Member
Topic starter
 

Thank you Catalin.  I haven't use Power Query yet but will definitely be able to use this.

 
Posted : 07/02/2019 9:27 pm
Share: