Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
vikas_nandanwar
Creator II
Creator II

Average - Department level Sum

Hi,

My data is as below -

 

DateDeptTotal
1-JanA100
1-JanB90
1-JanC 500
2-JanA110
2-JanB70
2-JanC 480
3-JanA150
3-JanB50
3-JanC 580
4-JanA120
4-JanB60
4-JanC 510
5-JanA180
5-JanB50
5-JanC 550

Pivot -

  

Row LabelsSum of Total
1-Jan690
2-Jan660
3-Jan780
4-Jan690
5-Jan780
Grand Total

3600

I want Average of Total of Date in Grand Total

Answer = 720

please help

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Try as expression

=Avg( Aggr( Sum(Total), Date))

with Date being your pivot table dimension.

In a straight table chart, you can use Sum(Total) as expression with total mode on expression tab set to avg of lines.

View solution in original post

23 Replies
swuehl
MVP
MVP

Try as expression

=Avg( Aggr( Sum(Total), Date))

with Date being your pivot table dimension.

In a straight table chart, you can use Sum(Total) as expression with total mode on expression tab set to avg of lines.

vikas_nandanwar
Creator II
Creator II
Author

Thanks

This worked

vikas_nandanwar
Creator II
Creator II
Author

Hi

Addition to this My data has multiple entries of Dept

 

DateDeptTotal
1-JanA100
1-JanB90
1-JanB30
1-JanC 500
2-JanA110
2-JanB70
2-JanC 480
2-JanC 30
3-JanA150
3-JanB50
3-JanB60
3-JanC 580
4-JanA120
4-JanA30
4-JanB60
4-JanC 510
5-JanA180
5-JanA30
5-JanB50
5-JanC 550

Pivot

  

Row LabelsSum of Total
1-Jan720
2-Jan690
3-Jan840
4-Jan720
5-Jan810
Grand Total3780

Answer = 756

Pleaes help

shraddha_g
Partner - Master III
Partner - Master III

in properties of this expression there will be an option "Show total as". There you can choose 'Avg'

vikas_nandanwar
Creator II
Creator II
Author

Where to see the properties of the expression

Anil_Babu_Samineni

This option won't work in Pivot table and only available this in straight table.

Why are you looking another option because stefan already gave right direction. Is that working or not?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
vikas_nandanwar
Creator II
Creator II
Author

Stefen's expression is working only if there are single entry for dept for single date
If there are multiple entries of dept for a single date the expression doesn't work, like

DateDeptTotal
1-JanA100
1-JanB90
1-JanB30
1-JanC500
Anil_Babu_Samineni

True, That means it has aggregate only for dates not for Dept. You can try something like below

=Avg( Aggr( Sum(Total), Dept, Date))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
vikas_nandanwar
Creator II
Creator II
Author

Doesn't work