Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
pinky1234
Contributor III
Contributor III

Need help for group by

Hi,

I am trying to load the four different excel files like below.

Table1:

ID,

Manager

Table2:

Status


Table3:

Status

Table 4:

Status

So i need to Group by ID,Manager and Max(Status) . So how can i achieve this?

1 Solution

Accepted Solutions
eduardo_dimperio
Specialist II
Specialist II

Ahhhh now you can in two diferent way.

1)

Table1:

LOAD

*

FROM

[Forecast_sampledata.xlsx]

(ooxml, embedded labels, table is Sheet2);

LEFT JOIN (TABLE1)

Table2:

LOAD

*

FROM

[Forecast_sampledata.xlsx]

(ooxml, embedded labels, table is Sheet3);

LEFT JOIN (TABLE1)

Table3:

LOAD

*

FROM

[Forecast_sampledata.xlsx]

(ooxml, embedded labels, table is Sheet4);

LEFT JOIN (TABLE1)

Table4:

LOAD ID, Status

FROM

[Forecast_sampledata.xlsx]

(ooxml, embedded labels, table is Sheet5);

Table_Result:

LOAD

ID,

Max(Status) AS MAX_STATUS,

Manager

RESIDENT Table1

GROUP BY

Manager,

ID;

//*************************************************************************

2)

2)

Table2:

LOAD

*

FROM

[Forecast_sampledata.xlsx]

(ooxml, embedded labels, table is Sheet3);

CONCATENATE (TABLE2)

Table3:

LOAD

*

FROM

[Forecast_sampledata.xlsx]

(ooxml, embedded labels, table is Sheet4);

CONCATENATE (TABLE2)

Table4:

LOAD ID, Status

FROM

[Forecast_sampledata.xlsx]

(ooxml, embedded labels, table is Sheet5);

LEFT JOIN (TABLE2)

Table1:

LOAD

*

FROM

[Forecast_sampledata.xlsx]

(ooxml, embedded labels, table is Sheet2);

Table_Result:

LOAD

ID,

Max(Status) AS MAX_STATUS,

Manager

RESIDENT Table2

GROUP BY

Manager,

ID;

View solution in original post

11 Replies
vishsaggi
Champion III
Champion III

Table2, 3, 4 do they have same name and number of columns in them? If yes autoconcatenation happens and you will left with Table2 with concatenated values from table3 and table4. Now, what is the link between Table1 and other tables, i mean any other columns you have in these that can join with Table1 or they going to be a datalsland?

eduardo_dimperio
Specialist II
Specialist II

Well, but how you want to agroup ID,Manager and Status if they dont have common fields?

pinky1234
Contributor III
Contributor III
Author

Table1:

ID,

Manager

Table2:

ID,

Status

Table3:

ID,

Status

Table4:

ID,

Status

From all the four tables id is the common one. I need to Group by ID,Manager and Max(Status).

pinky1234
Contributor III
Contributor III
Author

Can you post the syntax?

pinky1234
Contributor III
Contributor III
Author

Table1:

ID,

Manager

Table2:

ID,

Status

Table3:

ID,

Status

Table4:

ID,

Status

From all the four tables id is the common one. I need to Group by ID,Manager and Max(Status).Can you post the syntax please?

pinky1234
Contributor III
Contributor III
Author

Table2,table3 and table4 is the same number of columns with the same name. All four tables will have common name which is ID.

vishsaggi
Champion III
Champion III

May be try this? Change excel source name as yours.

Table2:

LOAD ID, Status

FROM

[Forecast_sampledata.xlsx]

(ooxml, embedded labels, table is Sheet3);

Table3:

LOAD ID, Status

FROM

[Forecast_sampledata.xlsx]

(ooxml, embedded labels, table is Sheet4);

Table4:

LOAD ID, Status

FROM

[Forecast_sampledata.xlsx]

(ooxml, embedded labels, table is Sheet5);

LEFT JOIN(Table2)

Table1:

LOAD ID,

     Manager

FROM

[Forecast_sampledata.xlsx]

(ooxml, embedded labels, table is Sheet2);

LEFT JOIN(Table2)

LOAD ID, Manager, Max(Status) AS MaxStatus

Resident Table2

Group By ID, Manager;

eduardo_dimperio
Specialist II
Specialist II

Ahhhh now you can in two diferent way.

1)

Table1:

LOAD

*

FROM

[Forecast_sampledata.xlsx]

(ooxml, embedded labels, table is Sheet2);

LEFT JOIN (TABLE1)

Table2:

LOAD

*

FROM

[Forecast_sampledata.xlsx]

(ooxml, embedded labels, table is Sheet3);

LEFT JOIN (TABLE1)

Table3:

LOAD

*

FROM

[Forecast_sampledata.xlsx]

(ooxml, embedded labels, table is Sheet4);

LEFT JOIN (TABLE1)

Table4:

LOAD ID, Status

FROM

[Forecast_sampledata.xlsx]

(ooxml, embedded labels, table is Sheet5);

Table_Result:

LOAD

ID,

Max(Status) AS MAX_STATUS,

Manager

RESIDENT Table1

GROUP BY

Manager,

ID;

//*************************************************************************

2)

2)

Table2:

LOAD

*

FROM

[Forecast_sampledata.xlsx]

(ooxml, embedded labels, table is Sheet3);

CONCATENATE (TABLE2)

Table3:

LOAD

*

FROM

[Forecast_sampledata.xlsx]

(ooxml, embedded labels, table is Sheet4);

CONCATENATE (TABLE2)

Table4:

LOAD ID, Status

FROM

[Forecast_sampledata.xlsx]

(ooxml, embedded labels, table is Sheet5);

LEFT JOIN (TABLE2)

Table1:

LOAD

*

FROM

[Forecast_sampledata.xlsx]

(ooxml, embedded labels, table is Sheet2);

Table_Result:

LOAD

ID,

Max(Status) AS MAX_STATUS,

Manager

RESIDENT Table2

GROUP BY

Manager,

ID;

pinky1234
Contributor III
Contributor III
Author

Everything is working. When i try to show that in table box Id,Manager and Status. I don't see the status column anything means showing column is empty