Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
sculptorlv
Creator III
Creator III

SUM with arguments

Hello, I have the table with such values:

 

Client  Item_Number Quantity

Alex      A                            5

Alex      B                           1

Alex      ZZ                         3

John     A                           4

 

 

I need to get for each client total quantity of each item, but I have situation where item A and B actually are the same and I need sum them together.

 

As the result I need to get table, (B and A are summed together and name is changed to B)

Client  Item_Number Quantity

Alex      B                           6

Alex      ZZ                         3

John     AB                          4

 

What would be the good solution for this problem?

 

Thank you in advance!

 

 

2 Replies
Channa
Specialist III
Specialist III

try to make calculated dimension

if (match (itemnumber,'A','B'),'AB',itemnumber)

it will help you

Channa
Vegar
MVP
MVP

I would go for a solution using ApplyMap().

Map:
MAPPING LOAD * inline [
ITEM, ALIAS
A,B
];

LOAD
Client,
Applymap('Map',Item_Number) as Item_Number,
Quantity
RESIDENT Table ;

The benefit of ApplyMap over if() and replace() is that you can with ease expand the list of field value replacements.

Read more here: https://help.qlik.com/en-US/sense/February2019/Subsystems/Hub/Content/Sense_Hub/Scripting/MappingFun...