Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
JonesBeach
Contributor III
Contributor III

Trying to merge rows from multiple columns into one column

I have a column called Test Dates which contains dates for Patients tests but then I have  two other columns with Entry and exit date of the patient. I want to create one column per patient ID that contains all the dates in one column. so Entry Date, CT Scan, MRI and Exit date. I am attaching a dummy data set and how I want it to look like. Any help is much appreciated!

Thanks!

Labels (3)
1 Solution

Accepted Solutions
Kushal_Chawda

@JonesBeach  try below

Data:
LOAD Distinct
"Patient ID",
"Entry Date" as [Merged Date],
'Entry Date' as [Tests Done]
FROM [lib://Files/Patient Data.xlsx]
(ooxml, embedded labels, header is 1 lines, table is Sheet1);

Concatenate(Data)
LOAD Distinct
"Patient ID",
"Tests Done",
"Entry Date" as [Merged Date]
FROM [lib://Files/Patient Data.xlsx]
(ooxml, embedded labels, header is 1 lines, table is Sheet1);

Concatenate(Data)
LOAD Distinct
"Patient ID",
"Exit Date" as [Merged Date],
'Exit Date' as [Tests Done]
FROM [lib://Files/Patient Data.xlsx]
(ooxml, embedded labels, header is 1 lines, table is Sheet1);

 

View solution in original post

3 Replies
hic
Former Employee
Former Employee

I would use a crosstable transformation when loading the data:

Crosstable ('Date Type', Date, 2)
Load [Patient ID], [Test Done], [Entry Date], [Test Dates], [Exit Date] From ...

Then you will get all dates in one column called [Date], and can choose to show either [Test Done] or [Date Type].

See more on
https://community.qlik.com/t5/Design/The-Crosstable-Load/ba-p/1468083

Kushal_Chawda

@JonesBeach  try below

Data:
LOAD Distinct
"Patient ID",
"Entry Date" as [Merged Date],
'Entry Date' as [Tests Done]
FROM [lib://Files/Patient Data.xlsx]
(ooxml, embedded labels, header is 1 lines, table is Sheet1);

Concatenate(Data)
LOAD Distinct
"Patient ID",
"Tests Done",
"Entry Date" as [Merged Date]
FROM [lib://Files/Patient Data.xlsx]
(ooxml, embedded labels, header is 1 lines, table is Sheet1);

Concatenate(Data)
LOAD Distinct
"Patient ID",
"Exit Date" as [Merged Date],
'Exit Date' as [Tests Done]
FROM [lib://Files/Patient Data.xlsx]
(ooxml, embedded labels, header is 1 lines, table is Sheet1);

 

JonesBeach
Contributor III
Contributor III
Author

Big help Kushal thanks so much for putting in time towards this.

Peace!