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

Set analysis question

Hi Everyone,

Thank you for taking a look at my question.

Here's the scenario:  I have a list of transactions and each transaction is made up of multiple line items that each belong to one department and have a net sales associated.  The data source is below:

TransactionKeyDepartmentNetSales
1A54
1B90
1E4
2B35
2C98
3D32
3B76
3F59
4A39
4C4
4F26

What I'm trying to do is create a straight table with Department as the dimension and have an expression that sums the entire transaction net sales for each transactions that has an item sold from the department.  The results would look like this:

DepartmentNet Sales
A217
B448
C202
D167
E148
F236

For example, department A has net sales of 217 because it TransactionKey 1 and 4 have an items sold from department A so I summed both of those transactions.

I've made several attempts to get the expression working by trying to aggregate Net Sales by TransactionKey but I'm not able to get it working properly.  If anyone could provide an example of the correct syntax I would greatly appreciate it!

Thank you,

Dan

14 Replies
qliksus
Specialist II
Specialist II

Hi,

Please use the expression as

sum(Aggr(Sum(Total <TransKey> NetSale),Dept,TransKey))

For reference

Dept sum(Aggr(Sum(Total <TransKey> NetSale),Dept,TransKey))
A217
B448
C202
D167
E148
F236
Not applicable
Author

Qliksus,

That is a work of art I am truly impressed!  Thank you very much for your help!

Best regards,

Dan

Not applicable
Author

Hi,

Thanks for the post,

Can you please explain the expression. Its very tricky for me to understand.

Thanks in Advance.

Regards,

Pavan Kumar.

qliksus
Specialist II
Specialist II

Hi Pavan,

If you break the requirement into small pieces then

part1: summation of total netsales by Transkey

part2: show the summation against respective dimension (Dept) which is a part of the Transkkey

part 1-OP: sum(Total <Transkey> NetSale)

Part2-OP: If u use above expression directly it will give total sales across the chart , not the total respective to selective Transkey.

You need AGGR function, it can be

Aggr(Sum(NetSale),Dept,TransKey)  : You need to put all dimension  which relates to your             requirement   part1   and part2

If you sum part-1OP & part-2OP then

Sum(Aggr(Sum(Total <TransKey> NetSale),Dept,TransKey))

Suggest you to do some exercise to get better undestanding.

Sorry if i don't able to expalin u how u want.

Regards,

Susant

Not applicable
Author

Hi Susant thanks for your clear explanation.