Announcements
cancel
Showing results for
Did you mean:
Creator

## weighted average

Hi!

In my attached file, there is a table (weighted average) where i need to compare the average of each user with the average (weighted) of the users of the same area and Department .

6 Replies
Partner - Specialist

Hi,

try like this:

avg of the user : avg (field)

avg of area and department : avg ( total <area, department> field)

Creator
Author

Hi StarinieriG!

Thanks for your reply but your indicacion doesn't solve my problem. Your expression just show the average of the Ded_day field regardless of the year or month selected or the area or department to which the user belongs.

For example, for user 2, if selected year is 2019 and month 1, weighted average value for his area (HR in my example) must be 3,608

 area Dep (ofic field) Num Users (A) sum Ded_day (B) cal (A*B) HR RES 3 4,04 12,12 RLA 2 2,96 5,92 Tot 5 18,04 Result 18,04/5= 3,608

Regards

Former Employee

Adding a comment to kick this one back up in the list given you attached a QVW to see if anyone else may have any ideas on things.  Unfortunately I am not too swift with the development items.  About the best I could guide you would be to check out the Design Blog area and the posts there to see if you can find something that will help:

https://community.qlik.com/t5/Qlik-Design-Blog/bg-p/qlik-design-blog

Maybe this one specifically:

https://community.qlik.com/t5/Qlik-Design-Blog/Average-Which-average/ba-p/1466654

Sorry I do not have anything better for you.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.
Creator
Author
Hi! Really appreciate your help. I've been checking the links and I've seen interesting things that I didn't know. Given my knowledge, I don't see the way to get the data I need. It may be too complicated Thank you for your help and for your time. Regards
MVP

Hi, in your document when I select 2019, january and area HR I see 6 different users, not 5.

Also I can't see how you wnat to see those results, it's a text with a global result? should be in a table like the one in this post?

Can you post a sample with the values you expect and the way you want to see them?

Creator
Author

Hi rubenmarin !

In the Weighted average table I calculate the average of the field I need to compare the average of the ded_day field for each user of both the selected period and the same period of the previous year. In principle I don't know if using the avg function is correct. What I need is in a table (or graph) to compare the average of the field ded_day of each user with the average of the same field of the department (Dep) and Area (Area) to which they belong in the year (and month or months selected) and from the same period of the previous year.

So in the table must appear the user, their average of the ded_day field for the selected period and the average of the same field for the area and department to which it belongs

taking into account that an area can contain one or more departments