Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Total not right in pivot chart

I have a pivot table and it must stay a pivot table that I can not get the total calculations on completed right and because of that the compliance is also wrong.  So for this example we are looking at just one location (600) and the month of May for 2017.  everything else is right except the ones in red at the bottom.

LocationDateSKU CountCompletedPossibleCompliance
6005/1/20173511100%
6005/2/20173511100%
6005/3/20173511100%
6005/4/20173511100%
6005/5/20173511100%
6005/8/20173511100%
6005/9/20173511100%
6005/10/20173511100%
6005/11/20173511100%
6005/12/20173511100%
6005/15/20173511100%
6005/16/20173511100%
6005/17/20173511100%
6005/18/20170010.00%
6005/19/20173511100%
6005/22/20170010.00%
6005/23/20173511100%
6005/24/20173511100%
6005/25/20173511100%
6005/26/20173511100%
6005/29/20170010.00%
6005/30/20170010.00%
6005/31/20173511100%
TOTAL6641234.35%

Here is the calculations for each row.

Location is a Dimension

Date is a Dimension

SKU Count = count({<[Type]={'Cycle'}>} DISTINCT [Prd Number])

Completed =   if([SKU Count] > 0, 1, 0)

Possible =

Sum(

if (WeekDay([Date]) = 'Mon' and Monday = 'X', 1 ,

if (WeekDay([Date]) = 'Tue' and Tuesday = 'X', 1 ,

if (WeekDay([Date]) = 'Wed' and Wednesday = 'X', 1 ,

if (WeekDay([Date]) = 'Thu' and Thursday = 'X', 1 ,

if (WeekDay([Date]) = 'Fri' and Friday = 'X', 1 , 0  )))))

)

Compliance =

if(Possible = '0' and Completed = '1', '0',

if(Possible = '0' and Completed = '0', '1',

( [Completed] / [Possible])))

Now all the other calculations work and compliance should work if I could get the completed to work correctly.  For Completed I have tried wrapping it with SUM() and COUNT() and both did not work. 

What can I do to get the completed total to be the correct number (19) rather then 1.

I have to have the chart as a pivot table I can not change it to any other chart.

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Completed =   sum(aggr(if( count({<[Type]={'Cycle'}>} DISTINCT [Prd Number]) > 0, 1, 0),Location,Date))


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar

Completed =   sum(aggr(if( count({<[Type]={'Cycle'}>} DISTINCT [Prd Number]) > 0, 1, 0),Location,Date))


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Thank you so very much! That worked.