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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
edemerdjieva
Partner - Creator
Partner - Creator

KPI sum problem

Hello all,

I have a chart displaying marketing action performance based on two KPI : total of sales and total of discounts.

The Fact table has the following fields:

Store IDReceipt IDItem IDSales Gross AmountSales Net AmountDiscountAction ID
1A11113.908.90--
1A20110.908.20--
1A20110.908.20--
1A1518.006.00--
1A111--5.00XY
1A201--2.70XY
1A201--2.70XY
1A151--2.00XY

The resulting chart has to be like this:

Action IDTotal SalesTotal Discount
XY31.3012.40

The problem is with the Total Sales Net Amount, defined as follows:

=Sum(Aggr(Sum(TOTAL <[Receipt ID]> [Sales Net Amount]),[Action Id], [Receipt ID]))

it takes into account distinct items. So in the example above the result is : 23.10 which is not correct. The good value should be 31.30.


Any idea how to write the expression?

Ce message a été modifié par : Elina Demerdjieva

Labels (1)
12 Replies
OmarBenSalem
Partner - Champion II
Partner - Champion II

In that case, we alter it as follow:

sum(total <ActionID> Measure)

Anonymous
Not applicable

Hello Elina,


Can you try this below expression and let me know whether the expression is working as you expected or not.


Expression : =Sum({<[Receipt ID] = , [Action ID] = ,[Item ID] = >} [Sales Net Amount])



Thanks & Regards,

Venkata Sreekanth

edemerdjieva
Partner - Creator
Partner - Creator
Author

Hi,

I found the solution. I added a row number to my data. Then the expression worked fine as there was a unique identifier.


Sum(Aggr(Sum(TOTAL <[Receipt ID]> [Sales Net Amount]),[Action Id], [Receipt ID]))

Thanks to all for helping!