Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
jagannalla
Partner - Specialist III
Partner - Specialist III

How to make relationship based on PrimaryKey?

Hi,

To make a relationship between the below 2 tables script i'm getting the error.

Table1:

LOAD ID,

     A,

     B,

     C

FROM

D:\RTQ\Test.qvd

(qvd);

Left Join(Table1)

LOAD

     // ID

    Max(A) as MaxA,

    Min(A) as MinA

Resident Table1;

- If i comment the ID then it is executing without the error. Even if i comment Left Join(Table1) and uncomment ID it is showing the error.

- One more thing i want to create qvd file for Table1 along with MaxA & MinA fields. To achive this i can taken in the script like this.

Table1:

LOAD ID,

     A,

     B,

     C

FROM

D:\RTQ\Test.qvd

(qvd);

Left Join(Table1)

LOAD

    Max(A) as MaxA,

    Min(A) as MinA

Resident Table1;

- I want to see in the table box the Max and Min value for pariticular ID only. Now it shows for all ID's as below image how can i overcome this.

Capture.PNG

1 Solution

Accepted Solutions
lironbaram
Partner - Master III
Partner - Master III

hei change your script to this:

Table1:

LOAD ID,

A,

B,

C

FROM

D:\RTQ\Test.qvd

(qvd);

Left Join(Table1)

LOAD

ID

Max(A) as MaxA,

Min(A) as MinA

Resident Table1

Gropu by ID;

it should work

View solution in original post

8 Replies
lironbaram
Partner - Master III
Partner - Master III

hei change your script to this:

Table1:

LOAD ID,

A,

B,

C

FROM

D:\RTQ\Test.qvd

(qvd);

Left Join(Table1)

LOAD

ID

Max(A) as MaxA,

Min(A) as MinA

Resident Table1

Gropu by ID;

it should work

jagannalla
Partner - Specialist III
Partner - Specialist III
Author

K Thanq..But i'm not able to catch Max an Min of the field.

For Eg:

My output show like this.

Capture1.PNG

lironbaram
Partner - Master III
Partner - Master III

hei

you wanted to see the max and the min A for every id and that what its displaying

i dont understand what you want can you post an example with the desired result

SunilChauhan
Champion II
Champion II

see the attched file

Sunil Chauhan
jagannalla
Partner - Specialist III
Partner - Specialist III
Author

Hi,

I attached my sample file along with description.

lironbaram
Partner - Master III
Partner - Master III

hei

look at this

SunilChauhan
Champion II
Champion II

please see the attached

will this help u?

Sunil Chauhan
jagannalla
Partner - Specialist III
Partner - Specialist III
Author

Thanks to helpme...

- I'm using below functionality to Quick load of max field value

Table1:

LOAD ID,

A,

B,

C

FROM

D:\A\Test.qvd

(qvd);


ALL_A:
Load FieldValue('A',IterNo()) as A1
AutoGenerate(1)
While not Isnull(FieldValue('A',IterNo()));


Max_A:

Load Max(A1) as MaxA resident ALL_A;
Drop table ALL_A;

- Now how can i make a join as below code for above table name Max_A.


Left Join(Table1)

LOAD

ID

Max(A) as MaxA,

Min(A) as MinA

Resident Table1

Gropu by ID;