Forum Discussion
Calculating an Average across two tables
Hi,
I'm struggling to calculate an average from data held in two tables and would really appreciate some help as I'm quite new to measures / DAX etc.
I have a table that holds records of meetings by sales teams and a second table that contains the head count for those teams and I would like to generate the average number of meetings based on headcount.
My table structure looks like this (simplified):
Table 1 = Activity
| Team Name | Meeting |
| Sales Team A | Meeting 1 |
| Sales Team A | Meeting 2 |
| Sales Team A | Meeting 3 |
| Sales Team A | Meeting 4 |
| Sales Team B | Meeting 1 |
| Sales Team B | Meeting 2 |
| Sales Team B | Meeting 3 |
| Sales Team B | Meeting 4 |
| Sales Team B | Meeting 5 |
Table 2 = Headcount
| Team Name | Headcount |
| Sales Team A | 2 |
| Sales Team B | 3 |
I can generate a measure that gives me the count of meetings (I'm using DISTINCTCOUNT as there may be dupe records):
Hi, Anonymous
Try to create a measure:Measure = DIVIDE( DISTINCTCOUNT(Activity[Meeting]),SELECTEDVALUE(Headcount[Headcount]))Result:
Please refer to the attachment below for details.
Hope this helps.
Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- lbendlin
Super User
oftentimes Power BI can provide a graphical answer - measures are only required when that is not possible. In your case you can make a small change to the data model to allow filtering of the dimension table from the fact table
and then you can use a table or matrix visual to show the result.
- v-angzheng-msft
Community Support
Hi, Anonymous
Try to create a measure:Measure = DIVIDE( DISTINCTCOUNT(Activity[Meeting]),SELECTEDVALUE(Headcount[Headcount]))Result:
Please refer to the attachment below for details.
Hope this helps.
Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.