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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Mahamed_Qlik
Specialist
Specialist

group by issue

Dear ALL,

I have table as below from where I want to get the min (ID) with respective to each party_id on selected period.

Table:

ID party_id amount

1002 101 100

1004 101 200

1005 105 115

2001 201 300

2002 201 225

2003 201 400

I have done as below

Load *

from Table;

Left join ( Table)

Load

Party_id

Min(ID) as MinID

resident Table

group by party_id;

I am getting below result:

Table:

ID party_id Amount MinID

1002 101 100 1002

1004 101 200 -

1005 105 115 -

2001 201 300 - ( //instead of null here we want its bill_id to be displayed)

2002 201 225 -

2003 201 400 -

Here is th issue is for IS 2001 we have only one record so its MinID is getting null (-) where we want if there is only one record then its ID should be consider as MinID. for rest of the record result is fine.

Kindly assist.

Labels (1)
1 Reply
vinieme12
Champion III
Champion III

Can you post the actual script you used?

this works fine as below

Table:
load * inline [
ID,party_id,amount
1002,101,100
1004,101,200
1005,105,115
2001,201,300
2002,201,225
2003,201,400
];


Left Join(Table)
Load party_id,min(ID) as min_ID
Resident Table
Group by party_id;

vinieme12_0-1670306190577.png

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.