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

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
ecabanas
Creator II
Creator II

Total bad calculation in pivot table

Hi,

I'm using a pivot table with the units, sales and Standard cost...I did an expression to know the margin in %...every article is well calculated, but the subtotal did not work, could anybody help me?

Thank's

Sum(Aggr(((Sum(EVE_AMOUNTMSTEXCLTAX)+Sum (QTYORDERED)*Avg (COSTEUDCASTD))/Sum(EVE_AMOUNTMSTEXCLTAX)),FAMILIA,ITEMID))

Familia and item are the Dimensions

table.jpg

1 Solution

Accepted Solutions
whiteline
Master II
Master II

Hi.

The expression gives you the sum of margins:

Sum(Aggr(((Sum(EVE_AMOUNTMSTEXCLTAX)+Sum (QTYORDERED)*Avg (COSTEUDCASTD))/Sum(EVE_AMOUNTMSTEXCLTAX)),FAMILIA,ITEMID))

I think you should first get Sum() for each FAMILIA,ITEMID and then divide it on Sum(EVE_AMOUNTMSTEXCLTAX):

=Sum(Aggr(Sum(EVE_AMOUNTMSTEXCLTAX)+Sum (QTYORDERED)*Avg (COSTEUDCASTD),FAMILIA,ITEMID)) / Sum(EVE_AMOUNTMSTEXCLTAX)

View solution in original post

2 Replies
whiteline
Master II
Master II

Hi.

The expression gives you the sum of margins:

Sum(Aggr(((Sum(EVE_AMOUNTMSTEXCLTAX)+Sum (QTYORDERED)*Avg (COSTEUDCASTD))/Sum(EVE_AMOUNTMSTEXCLTAX)),FAMILIA,ITEMID))

I think you should first get Sum() for each FAMILIA,ITEMID and then divide it on Sum(EVE_AMOUNTMSTEXCLTAX):

=Sum(Aggr(Sum(EVE_AMOUNTMSTEXCLTAX)+Sum (QTYORDERED)*Avg (COSTEUDCASTD),FAMILIA,ITEMID)) / Sum(EVE_AMOUNTMSTEXCLTAX)

ecabanas
Creator II
Creator II
Author

Hi Whiteline,

Thank you very much!!!!! EXCELENT!!!