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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
narender123
Specialist
Specialist

not calculating same data in concatenation

Hi all,

I have two tables like:-

table1:

area,city,month

x,delhi,1

y,gurgoan,2

z,mumbai,3


concatination


table2:

id,name,branch,salary,month

1,rahul,a,100,1

2,amit,b,200,2

1,rahul,b,100,1

i am doing concatination between two table. if i remove branch (distinguish between rows of 2nd table) column then

sum(salary)= 300 which is worng

if i take all fields remain same then

sum(salary)= 400 which is right.


Some one tell me how it is happening.


Thanks,


Narender

7 Replies
Mark_Little
Luminary
Luminary

Hi,

Can you please supply more details.

Where are you doing the sum(Salary)

Maybe supply a sample qvw?

Mark

nagarjuna_kotha
Partner - Specialist II
Partner - Specialist II

Can you share sample data and Expected output ?

Regards,

Nagarjuna

MK_QSL
MVP
MVP

because both table are associating by month field

1,rahul,a,100,1

1,rahul,b,100,1


rahul is having two branch a and b.. So if you remove branch, it would be one record only...

effinty2112
Master
Master

Hi Narendar,

I get the correct answer with this script both when I include the branch field or not:

Table1:

LOAD * INLINE [

    area, city, month

    x, delhi, 1

    y, gurgoan, 2

    z, mumbai, 3

];

Concatenate(Table1)

//LOAD * INLINE [

//    id, name, branch, salary, month

//    1, rahul, a, 100, 1

//    2, amit, b, 200, 2

//    1, rahul, b, 100, 1

//];

LOAD * INLINE [

    id, name, salary, month

    1, rahul, 100, 1

    2, amit, 200, 2

    1, rahul, 100, 1

];

In your script is it possible that your second table is being loaded with a DISTINCT clause? That would reduce it to

    id, name, salary, month

    1, rahul, 100, 1

    2, amit, 200, 2

if branch was omitted but if the branch field was included the table would be

    id, name, branch, salary, month

    1, rahul, a, 100, 1

    2, amit, b, 200, 2

    1, rahul, b, 100, 1

effinty2112
Master
Master

But the tables are being concatenated not associated by month as a key field.

Table View.JPG

buzzy996
Master II
Master II

it's displaying 400,right! how u got 300 first?

tot.PNG

narender123
Specialist
Specialist
Author

Hi All,

Thanks for your reply.

I have created table 2. via cross table.During this creation  i have taken all columns include branch but in last i have removed columns like branch.I think this is due to cross table.So i have taken all columns and got right result.