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: 
tschullo
Creator III
Creator III

Help with Average of Averages in Reference line

I have a bar chart that shows the average hours spent on audits by team name in the "Reporting" phase of the project.
I'm only interested in hours logged in United States audits where the field RscActuals='Y'.

Since I am only interested in audits >= 2019, my Dimension is:  

=if([Audit Year]>=2019,[Lead Team])

My expression includes set analysis and looks like this:

Sum({<[Audit Task]={"Reporting"}, RscActuals={'Y'}, [Audit Region]={'United States'}>} Hours) /Count({<RscActuals={'Y'}, [Audit Region]={'United States'}>} DISTINCT [Audit ID])

In QlikView I had an "Average" reference line (built in) that I am trying to replicate in QS.

I have searched through the posts to find some help, but nothing is working for me.

It should be something like:

Avg(Total Aggr(
Sum({<[Audit Task]={"Reporting"}, RscActuals={'Y'}, [Audit Region]={'United States'}>} Hours)/Count({<RscActuals={'Y'}, [Audit Region]={'United States'}>} DISTINCT [Audit ID])
, [Lead Team]))

But I can't get it to work.  Please help!

Labels (1)
10 Replies
tschullo
Creator III
Creator III
Author

Team   Audit    Hrs    Rsc Ctr         Rsc ID

A           A123       5          France       1

A           A103       15        Canada       2

B           A123       15       France       3

B           A123       25       Canada       4

C           A111       30      Canada       5

C           A123       50      Canada       6

 

If I have no ctry selection bars are A=10, B=20, C=40. Average should be 35. Current expression works.

But if I select France, bars should be A=5, B=15 and average would be 10, not 20/3.

I'm not at work today, will give you exact model Monday.