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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Wimmer-Logistik
Contributor III
Contributor III

PIVOT Table with multiple String values per Cell

Hello, 

do i have a chance to build from a datasource which looks like

DateDepartmentEmployee
8/8/20211A
8/8/20211B
9/8/20212A
9/8/20212C

 

a pivot table which looks like this:

 Department
1
Department
2
8/8/2021A
B
 
9/8/2021 A
C

 

In words:
Two (or more) string values in below order, without adding a new dimension

What i found was concat Funktion, but this only glues values together without line breaks

Any ideas?

 

Labels (1)
2 Replies
Taoufiq_Zarra
MVP
MVP

@Wimmer-Logistik  Maye be like :

Input:
 LOAD * INLINE [
    Date , Department, Employee
    8/8/2021, 1, A
    8/8/2021, 1, B
    9/8/2021, 2, A
    9/8/2021, 2, C
];


DATA:
 Generic LOAD Date as D1, 'Department '&Department as D2, concat(Employee,' ') as E1 resident Input group by Date,Department;
 

CombinedGenericTable:

Load distinct Date as D1 resident Input;

drop table Input;

FOR i = NoOfTables()-1 to 0 STEP -1

  LET vTable=TableName($(i));
  //trace $(i) - '$(vTable)';
  IF WildMatch('$(vTable)', 'DATA.*') THEN 

  LEFT JOIN ([CombinedGenericTable]) LOAD distinct * RESIDENT [$(vTable)];

  DROP TABLE [$(vTable)];

  ENDIF 

NEXT i

 

output:

Taoufiq_Zarra_0-1627934037079.png

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Wimmer-Logistik
Contributor III
Contributor III
Author

Hi,

thanks for your reply and your idea.

This is what i can already achive by using a pivot table in frontend.

What i wanted to do is, to write the employees in seperate lines.

Not written next to each other...

Is it somehow possible in a pivot table?

Tried it with chr(10) and chr(13) as delimeter, but this won't work in a pivot.

Any other ideas?

bye

Markus