Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
pgalvezt
Specialist
Specialist

Split same value into the sum

Hello,

I have many salesman,

How could sum the same salesman in 2 groups separately.

If(Vendor1='a','a',

If(Vendor1='a','b',

If(Vendor2='b','b',

If(Vendor3='c','b',

If(Vendor4='d','b',


When I do the statement vendor 1 dissapear


I want that my pivot show


The total in b

and the total a


Final Result

158.539.379


Thanks!

10 Replies
sunny_talwar

The field names in your QlikView file are different then the example you are giving here. I have no idea what matches to what.

Best,

S

cesaraccardi
Specialist
Specialist

Hi Pablo,

Have a look at the attachment.

If I understand it correctly you have a many to many relationship between salesman and group. So you have to create a separate table for this to work. I have included some code at the bottom of the script, you will have to reload it to see the results.

Kind Regards,

Cesar

pgalvezt
Specialist
Specialist
Author

Hi,

Thanks for your reply,

For January 2014 I have in my excel file

Final Result

Blue has 58.054.886

Red has 100.484.493

Total

158.539.379



You have 277.139.309

pgalvezt
Specialist
Specialist
Author

That was an example. is not my script.

cesaraccardi
Specialist
Specialist

Hi,

Can you post a screenshot of the application after it was reloaded please?

pgalvezt
Specialist
Specialist
Author

After reload,

Blue its Ok 58.054.886

Red Should be 100.484.493

cesaraccardi
Specialist
Specialist

Pablo,

Alright, try replacing the two LOAD statements at the bottom by this one, that should give what you are looking for.

Ingresos:

LOAD * INLINE
[
vendedor,Ingresos
NM,Blue
NM,Red
JEC,Red
MT,Red
PR,Red
]
;


pgalvezt
Specialist
Specialist
Author

Gave the same result, Check out that cod NM = Blue appears in Red Too.

So with my first app i had this:

What I Want is

Red 42.429.607 + 58.054.886

Blue 58.054.886

Final Total 158.539.379

cesaraccardi
Specialist
Specialist

Ok,

If you were using a straight table it would be just a case of changing the total calculation, for the pivot table you will have to change the expression as well:

sum(aggr(sum(monto_actual),ano,mes,Ingresos))