Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
thanhphongle
Creator II
Creator II

Mapping tables

Hello Community

I have several tables wich I would like to map to my Table "Main" in the script.

These are my tables

Table Product

Product IDProductnameCategory
P10001AF
P10002BG
P10003CH
P10004DI
P10005EJ

Table facility

Location IDCityCountry
L10001BerlinGermany
L10004MosowRussia
L10005TokyoJapan

Table Main

C IDNameProduct IDLocation IDCostQuantity
C1001n1P10001L100011001
C1002n2P10001L100012002
C1003n3P10001L100013003
C1004n4P10002L100014004
C1005n5P10002L100012005
C1006n6P10003L100041006
C1007n7P10003L100041007
C1008n8P10003L100051508
C1009n9P10003L100041605
C1010n10P10004L100051706
C1011n11P10005L100051802
C1012n12P10005L100051902

First of all, is a mapping function in the script really needed because QV is actually setting the relation between the tables. When I count unique products, QV returns me the real quantity + 1 which is wrong. Can anyone explain me why QV is doing it?

I used the function count(distinct ([Product_ID]))

If there s a mapping needed how can I do it?

And another question:

Is it possible to count datas from certain tables? Example:

count(Product ID) where Table = Main -> 12

count(Product ID) where Table = Product -> 5

3 Replies
awhitfield
Partner - Champion
Partner - Champion

First of all, is a mapping function in the script really needed because QV is actually setting the relation between the tables.

No - that's not require

Count(distinct product_id_ returns 5

Count(product_id) returns 12

HTH

Andy

thanhphongle
Creator II
Creator II
Author

Actually I have another database which I cant upload.

For this case I created a new attribut called unique_id_product and let it count through starting by 1

in my expression I always have to add the if function

count(if(unique_id_product>0, [Product_ID])

If I dont add the if expression it does not count me the right number of products in the Main table.

So is there an expression where I can choose the the attribute and the referring table.

I know that QlikSense automatically adds the table name behind the attribut if you have two same attribut from different tables.

Example

Product_ID  =  Table Main

Product_ID  =  Table Product

QlikSense

[Product_ID.Main]

[Product_ID.Product] somehow like that.

MindaugasBacius
Partner - Specialist III
Partner - Specialist III

Could you implement unique_id_product into the above example you've shared?