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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Partial Sums in Pivot Table

I have the following expression:

   Sum({$<DTCDTID = {'*'}>} distinct Total <SDT,SFT,PLID> UTM)

This is delivering the cell values
as I need but partial sums are not being calculated correctly




















SFT


 

Sum({$<DTCDTID = {'*'}>} distinct Total <SDT,SFT,PLID> UTM)



 

A


 

400


 

B


 

480


 

C


 

480


 

Partial Sum


 

880


 

As shown in the above example partial sum is calculated as ‘880’
. I want this to be calculated as ‘1360’.

How it is possible??

Labels (1)
8 Replies
MayilVahanan

HI

Try like this

If(rowno() = 0 or isnull(rowno()),

     Sum({$<DTCDTID = {'*'}>} Total<SDT,SFT,PLID> UTM),

     Sum({$<DTCDTID = {'*'}>} distinct Total<SDT,SFT,PLID> UTM)

)

hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

hi

try this

if(dimensionality =0,

sum(aggr(Sum({$<DTCDTID = {'*'}>} distinct Total <SDT,SFT,PLID> UTM),SFT)),

Sum({$<DTCDTID = {'*'}>} distinct Total <SDT,SFT,PLID> UTM)

)

regards

GERNAN


Not applicable
Author

Thanks Gernan, but for some reason it is showing error in expression. It seems like its not registering the 'Dimensionality' within the syntax.

Not applicable
Author

Thanks Rama, I tried it but the totals are still the same. It does not add up to the total I need. Please suggest.

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Try this expression.

     Sum(aggr(

Sum({$<DTCDTID = {'*'}>} distinct Total <SDT,SFT,PLID> UTM),SFT))

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

Hi Kaushik,

I tried it but it took off all the data from the cells. I have DTCDID at the top of the pivot table, I dont know if that affects the expression.  Following is the layout , I am talking about.

    


 

DTCDTID


 

 

CO


 

 

MNT


 

 


 

SFT


 



   


 

 


 

Sum({$<DTCDTID = {'*'}>} distinct Total <SDT,SFT,PLID> UTM)


 



 

 


 


 



   


 

 


 

Sum({$<DTCDTID = {'*'}>} distinct Total <SDT,SFT,PLID> UTM)


 



 

 


 


 



   


 

 


 

A


 



   


 

 


 

400


 



   


 

 


 

220


 



   


 

 


 

B


 



   


 

 


 

480


 



   


 

 


 

200


 



   


 

 


 

C


 



   


 

 


 

480


 



   


 

 


 

200


 



   


 

 


 

Partial Sum


 



   


 

 


 

880


 



   


 

 


 

420


 



   


 

 


 

Sum should be


 

 


 

1360


 

 


 

620


 

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Include all the dimensions into the aggr list.

     Meaning.

     Say if you have field1,field2,field3 in dimension then your expression should be

    

Sum(aggr( 

Sum({$<DTCDTID = {'*'}>} distinct Total <SDT,SFT,PLID> UTM),field1,field2,field3))

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

ok . use dimension to your general total like this

see the underline

if(dimensionality =0,

sum(aggr(Sum({$<DTCDTID = {'*'}>} distinctTotal <SDT,SFT,PLID> UTM),DTCDTID )),

Sum({$<DTCDTID = {'*'}>} distinct Total <SDT,SFT,PLID> UTM)

)

regards

GERNAN