Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Prabhu1204
Creator
Creator

Cross Table

Hello Everyone,

Is it possible to do the cross table using the excel default field name,

I have a site in A1 and Team Name in A2.. The site name and team will be different for all the files. So I want to bring A1 and A2 as a column. 

 

Prabhu1204_0-1608793765833.png

 

TIA

 

-Prabhu
1 Solution

Accepted Solutions
Taoufiq_Zarra

@Prabhu1204  if I understood correctly:

you have for example a folder with numbers (example 3) of Excel file (or other format) like :

Taoufiq_Zarra_0-1608816595652.png

 

and each file contain for exemple two line like :

Capture.PNG

and you want an output with Sites and Type for all file ?

so maye be this help, you can optimise the script if u want :

FOR Each File in filelist ('C:\Users\t.zarra\Downloads\Qlik24122020\File*.xlsx')
		
	DATA:
	LOAD A as Sites
	FROM
	'$(File)'
	(ooxml, no labels, table is Sheet1)  Where recno()=2;
	
	join
	 	
	LOAD A as Type
	FROM
	'$(File)'
	(ooxml, no labels, table is Sheet1)  Where recno()=3;


NEXT File;

SET vConcatenate = ;   

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


  LET vTable=TableName($(i));
  
  Final:
  $(vConcatenate)
  LOAD distinct *,'' as TmpField RESIDENT [$(vTable)];

  DROP TABLE [$(vTable)];
 SET vConcatenate = Concatenate; 

NEXT i

drop fields TmpField;

 

output:

Capture.PNG

 

Regards,
Taoufiq ZARRA

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

(you can mark up to 3 "solutions") 😉

View solution in original post

6 Replies
Taoufiq_Zarra

@Prabhu1204  can you share a sample data and the expected output

Regards,
Taoufiq ZARRA

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

(you can mark up to 3 "solutions") 😉
Prabhu1204
Creator
Creator
Author

The data will be like the attached. I have to use A and B field for implementing section access

-Prabhu
Prabhu1204
Creator
Creator
Author

 
-Prabhu
Taoufiq_Zarra

@Prabhu1204  always 2 rows by file ?

Regards,
Taoufiq ZARRA

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

(you can mark up to 3 "solutions") 😉
Prabhu1204
Creator
Creator
Author

Yes, I should map the two rows with my main data. Column A would be  Sites and Column B would Type.

-Prabhu
Taoufiq_Zarra

@Prabhu1204  if I understood correctly:

you have for example a folder with numbers (example 3) of Excel file (or other format) like :

Taoufiq_Zarra_0-1608816595652.png

 

and each file contain for exemple two line like :

Capture.PNG

and you want an output with Sites and Type for all file ?

so maye be this help, you can optimise the script if u want :

FOR Each File in filelist ('C:\Users\t.zarra\Downloads\Qlik24122020\File*.xlsx')
		
	DATA:
	LOAD A as Sites
	FROM
	'$(File)'
	(ooxml, no labels, table is Sheet1)  Where recno()=2;
	
	join
	 	
	LOAD A as Type
	FROM
	'$(File)'
	(ooxml, no labels, table is Sheet1)  Where recno()=3;


NEXT File;

SET vConcatenate = ;   

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


  LET vTable=TableName($(i));
  
  Final:
  $(vConcatenate)
  LOAD distinct *,'' as TmpField RESIDENT [$(vTable)];

  DROP TABLE [$(vTable)];
 SET vConcatenate = Concatenate; 

NEXT i

drop fields TmpField;

 

output:

Capture.PNG

 

Regards,
Taoufiq ZARRA

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

(you can mark up to 3 "solutions") 😉