Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
AFigueiredo
Contributor II
Contributor II

Selecting a value based on another field's value

Good morning,

I'm fairly new to Qlikview and I'm currently stuck on this, so I'd appreciate any help given.

I have some fields from 2 different databases and I want to relate them. For example, let's say Serial No. A and Serial No. B are from 2 distinct databases, and these are their values. There are also other fields in the database, that are all related.

Serial No. A

1000

2000

3000

4000

 

Serial No. B

Test1

Test2

Test3

Test4

 

Serial No. A and Serial No. B are related to each other, corresponding Serial No. A 1000 to Serial No. B Test 1, Serial No. A 2000 to Test 2, and so on.

How can I associate them so that later, in a pivot table, I can select Serial No. A and get Serial No. B back, and all other field data associated to Serial No. B and its database? I'm leaving an example of what I want it to be.

I can imagine this being hard to comprehend, as it's not easy to explain.

 

Thanks in advance,

Best regards

4 Replies
QFabian
Specialist III
Specialist III

Hi @AFigueiredo , if there is no relation between fields, you can create a table with the different expected combinations, and then use mapping to get the second field for every single row:

A:
Load * INLINE [
Serial No. A
1000
2000
3000
4000
];


B:
mapping
Load * INLINE [
A, B
1000, Test1
2000, Test2
3000, Test3
4000, Test4
];

Result:
Load
[Serial No. A],
applymap('B', [Serial No. A]) as [Serial No. B]
Resident A;

drop table A;

 

QFabian
Saravanan_Desingh

Try like this,

tab1:
Load RowNo() As Key,* INLINE [
Serial No. A
1000
2000
3000
4000
];

Left Join(tab1)
Load RowNo() As Key,* INLINE [
Serial No. B
Test1
Test2
Test3
Test4
];
Saravanan_Desingh

Data Model:

commQV72.PNG

AFigueiredo
Contributor II
Contributor II
Author

Hello

The fields are related. Whenever I select my Serial No. A, I get the corresponding Serial No. B (as intended). However, B has other related fields, and I'm getting all of them, not only the ones that are related to both B and A (i.e, they're related to B which is dependent on A).

 

EDIT:

Is there a way I can filter these latter fields? As in some sort of "If A = 100 and B = Test 1, C = 200" ? 

 

Thank you for answering!