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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
pkelly
Specialist
Specialist

Pivot Table - match Not Giving Total

Activity# of TransactionsTotal Transaction Cost (A)# of LinesTotal Picking Cost (B)# of Vehicle DropsTotal Delivery Cost (C)SalesGross ProfitGross Less A, B and C Costs
Back to Back Invoice - Invoice101003000010,0002,5002,400
Collected Order - Invoice11110333300011,0002,7502,310
Delivered Order - Invoice12120363601,08010,80012,0003,000-8,280
Invoice Adjustment - Credit1313039000-13,000-3,250-3,380
Invoice Adjustment - Invoice141404200014,0003,5003,360
Manual Credit - Credit1515045000-15,000-3,750-3,900
Manual Invoice - Invoice161604800016,0004,0003,840
POS - Refund - Credit1717051000-3,000-750-920
POS - Sale - Invoice18180545400018,0004,5003,780
Total1261,26037801,080050,00012,50011,240


I have the pivot table above...

the issue that I have is that I am not getting totals for the "Total Picking Cost (B)" and "Total Delivery Cost (C)".

"Total Transaction Cost (A)" is giving me a total.

The formula for A is...

=Count(DISTINCT sin_TransactionNumber) * varTransactionCost

Whilst B is...using match as this costs is only applied to specific transaction types

=IF(Match(sin_ActivityAnalysisIoC,'Collected Order - Invoice','Delivered Order - Invoice','POS - Sale - Invoice'), Sum(sin_LineCount) * varPickingLineCost,0)

And C is...using match as this costs is only applied to specific transaction types

=IF(Match(sin_ActivityAnalysisIoC,'Delivered Order - Invoice'), COUNT(DISTINCT if(sin_ActivityAnalysis = 'Delivered Order', %VehicleRunDropKey)) * varDeliveryCost,0)

It is also affecting my main total...

=sum(sin_GrossProfit) - [Total Transaction Cost (A)] - [Total Picking Cost (B)] - [Total Delivery Cost (C)]

How can I get the totals displayed for each colum / affect my total...

Confused

1 Solution

Accepted Solutions
brenner_martina
Partner - Specialist II
Partner - Specialist II

Hi Paul,

you have to use the function SUM() in every expression at the very beginning, if this does not work, look for function AGGR() in the helpfile.

View solution in original post

2 Replies
brenner_martina
Partner - Specialist II
Partner - Specialist II

Hi Paul,

you have to use the function SUM() in every expression at the very beginning, if this does not work, look for function AGGR() in the helpfile.

pkelly
Specialist
Specialist
Author

Thanks Martina - sometimes the obvious is staring you in the face and you cannot see it........