Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Diana_B
Contributor II
Contributor II

Wrong values in total row in pivot table

Hi!

Can you help me with the following problem?

I want to show the sum of each field in the pivot table.

Unfortunataly it doesn’t work to sum the values for the following field:
„Therapiedauer in Stunden“.

Furthermore the sum for the following field is calculated wrongly:
„Therapiedauer in Stunden pro Woche“.

 

What can I do to get the correct sum for each field?

Many thanks in advance for your help!

 

Best regards,

Diana

1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Try these expressions.

1. Therapiedauer in Stunden :

Sum(Aggr(Sum(Therapieanzahl) * Therapiedauer_in_Stunden,[Patienten-ID],[KTL-Code]))

2. Therapiedauer in Stunden pro Woche:

Sum(aggr((Sum(Therapieanzahl)*Max(Therapiedauer_in_Stunden))/Max([Aufenthaltsdauer in Wochen]),[Patienten-ID],[KTL-Code]))

 

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

View solution in original post

4 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

What is the expected result?

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

The excpected result for column "Therapiedauer in Stunden" is 36451,21; the sum of all values, when the pivot table is expanded.
The excpected result for column "Therapiedauer in Stunden pro Woche" is 11779,37; also the sum of all values, when the pivot table is extended.

I say "the sum when the pivot is extended", because there is also a problem with the totals for each "Patienten-ID" when the fields of the pivot-table are collapsed.
E. g. for Patienten-ID 100001 there is no shown (collapsed) value for column "Therapiedauer in Stunden" but it should be 34,92 and for column "Therapiedauer in Stunden pro Woche" the collapsed value is 33,38 but it should be 17,49.

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Try these expressions.

1. Therapiedauer in Stunden :

Sum(Aggr(Sum(Therapieanzahl) * Therapiedauer_in_Stunden,[Patienten-ID],[KTL-Code]))

2. Therapiedauer in Stunden pro Woche:

Sum(aggr((Sum(Therapieanzahl)*Max(Therapiedauer_in_Stunden))/Max([Aufenthaltsdauer in Wochen]),[Patienten-ID],[KTL-Code]))

 

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

Thank you so much!

I have tried it with the aggregation before, but apparently I made a mistake somewhere.

This works perfectly!

Best regards,
Diana