Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
paweln
Contributor III
Contributor III

How to calculate dimension using two fields from different tables?

Dear All,

I would like to have new field in table "Inspekcje". 

If(sum([Ilość Defektu])>0, 'Y', 'N') as "With defects"

but field [Ilośc Defektu] comes from different table then the one that should have "With defects" field.

There may be many records with the same REF in "Defekty". REF is unique in "Inspekcje".

How to do it in the script?

paweln_0-1593756818331.png

 

1 Solution

Accepted Solutions
Kushal_Chawda

try below

Map_Weight:
mapping LOAD
    SIZE,
    WEIGHT
FROM [lib://Data/two tables.xlsx]
(ooxml, embedded labels, table is Arkusz3);

Data:
LOAD
    ID,
    SIZE,
    pcs,
    if(pcs*ApplyMap('Map_Weight',SIZE,0)>3000,'Y','N') as [Target Achieved]
FROM [lib://Data/two tables.xlsx]
(ooxml, embedded labels, table is list);

View solution in original post

7 Replies
Taoufiq_Zarra

can you share a sample data and the output ?

Regards,
Taoufiq ZARRA

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

(you can mark up to 3 "solutions") 😉
paweln
Contributor III
Contributor III
Author

This is example data.

paweln_0-1594293302373.png

I would like to have table like this:

paweln_1-1594293342651.png

 

where last dimension is calculated in the script. "Y" if pcs*weight > 3000.

 

How the cript should look like when I want to multiply fields from two different tables?

arulsettu
Master III
Master III

Is this your expected output?

arulsettu_0-1594294508627.png

 

paweln
Contributor III
Contributor III
Author

Basically Yes. Only I need that as a dimension not a measure.

NitinK7
Specialist
Specialist

Hi,

Write calculated dimension like

=if((pcs*WEIGHT)>3000,'Y','N')

Capture.PNG

arulsettu
Master III
Master III

we can use the same logic in Dimension

arulsettu_0-1594299628000.png

 

Kushal_Chawda

try below

Map_Weight:
mapping LOAD
    SIZE,
    WEIGHT
FROM [lib://Data/two tables.xlsx]
(ooxml, embedded labels, table is Arkusz3);

Data:
LOAD
    ID,
    SIZE,
    pcs,
    if(pcs*ApplyMap('Map_Weight',SIZE,0)>3000,'Y','N') as [Target Achieved]
FROM [lib://Data/two tables.xlsx]
(ooxml, embedded labels, table is list);