Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
vidyasagar159
Creator II
Creator II

QlikSense SelfJoins Update Sales Amount for other Ages

Hello All,

Hope you all doing great.!!!

I want to create a new aggregated column for the Product age is at Zero and that value should update all the cell values with different ages.

Below is the logic I have used, I know this is not correct:

AgeTable:
load * Inline [
ID, PAge, sales
A1, 0, $50
A2, 1, $100
A3, 2, $200
B1, 0, $30
B2, 1, $100

];

left Join(AgeTable)
load ID as ID,
PAge as UAge,
sales as Usales
Resident AgeTable
where PAge = 0

Result:

Capture.JPG

Result Expectin:

IDAgesalesSales at age Zero
A10$50$50
A21$100$50
A32$200$50
B10$30$30
B21$100$30
2 Replies
Marcos_rv
Creator II
Creator II


I understand what you want to do, you want all the ids that begin with the letter A (a0, a1, a2, a3, a4) to add the value of a0 ($ 50) in the USALES field, this could be added using a letter to group, it would be as follows:

 

AgeTable:
load *,
left (ID, 1) as group;
load * Inline [
ID, PAge, sales
A1, 0, $ 50
A2, 1, $ 100
A3, 2, $ 200
B1, 0, $ 30
B2, 1, $ 100

];

left Join (AgeTable)
load
group,
// ID as ID,
PAge as UAge,
Sales as Usales
Resident AgeTable
where PAge = 0;

this should work for you.

Regards!!!

Marcos_rv
Creator II
Creator II

Or try 

AgeTable_AUX:
load * Inline [
ID, PAge, sales
A1, 0, $ 50
A2, 1, $ 100
A3, 2, $ 200
B1, 0, $ 30
B2, 1, $ 100

];

 

AgeTable:

load *,
left (ID, 1) as group

resident AgeTable_AUX;

DROP TABLE AgeTable_AUX;

left Join (AgeTable)
load
group,
// ID as ID,
PAge as UAge,
Sales as Usales
Resident AgeTable
where PAge = 0;