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

Possible Selection?

Hello,

I have two tables and uploaded from two excel files and both linked with Emp Id key. The table names are Productivity and Qc. Now, I want to get the qc count for the employee whose name present in productivity. I have tried like below but unable to get the result.

count({<Productivity.EmpName=P(QC.WorkedBy={'$(Productivity.EmpName)'})>}EmpID)

Please see the attachment and provide the solution please.

24 Replies
awhitfield
Partner - Champion
Partner - Champion

Hi Tamil,

to start with, your employee IDs don't match between the tables, they are prefixed by Q in the QC table

Andy

tamilarasu
Champion
Champion
Author

Hi Andrew,

My mistake. Its just a sample file. The Id's are belongs to the persons who done quality check for the employees. Say for example, I have to show the Qc count for the employee name 'Abi' as 1. He got one qc count in Qc table. Like wise siva should get 2. I have changed the Emp id to date key. Hope you understand my problem.

tamilarasu
Champion
Champion
Author

Any Idea? twitching-smiley-emoticon.gif

danieloberbilli
Specialist II
Specialist II

like that? please find .qvw attached

tamilarasu
Champion
Champion
Author

Hi Daniel,

I can see count mismatch in the table. Please see below.1.PNG

In Qc table, Employee siv has two Qc counts and rest having only one Qc count. !

ToniKautto
Employee
Employee

The sample file is not properly loading the data. In table QC the actual headers are loaded as the first data row, which is probably not what you want.

As best practice I think you should prefix your key fields, so that you distinguish them from the other fields. You should not use the key fields in your dimensions, expressions or calculations. A key field contains the values of both associated tables, so a aggregation might allocate more memory than intended and target unexpected data.

For example if you perform a Count() in the key field, what value are you expecting? Rows in TableA, rows in TableB, an intersection of the rows in both?

To resolve this logical problem, simply duplicate the key field in the table. And use the non-key field in aggregations.

As suggested previously you need to normalize your key values so that they actually match. In other words remove the leading Q in QC.EmpID.

If the attached is not what you expect, please clarify what the resulting table should look like.

ToniKautto
Employee
Employee

Is this what you expect, or what is the expected result?

2015-05-22 13_05_06-QlikView x64 - [C__Users_tko_Documents_Community Content &amp; Material_164969_QC-16.png

danieloberbilli
Specialist II
Specialist II

Sorry I cant follow your data - it seems that your EmpName has now become WorkedBy.

I think you just need to be aware of your straight (or pivot) table dimension and expression:

if you want to see the # of the QC table then use the employee field of the QC table as dimension ...in your example you are using the field from productivity

tamilarasu
Champion
Champion
Author

Hello Toni,

Yes. The above table is what I expected. I want to display the Qc count done for that particular employee. But there are no Emp id field for that employees in QC table (rather emp id for the Qc persons). The only way we can match the count by using the Worked by name field. Hope you get my point. Is it possible.?