cancel
Showing results for
Did you mean:
Frequent Visitor

## Average a measure's results for a group

I've gotten rusty with DAX and this should be an easy formula, but I'm not asking it in the right way to get the right search.

I have a function that calculates how many customers each team member has.  I'd like to create a measure that calculates the average customer count for the entire team so the manager can see how close the individual is to the team average.

Here's my data:

To make it easier to understand, here it is summarized:

The measure [Count of Cust ID] is DISTINCTCOUNTNOBLANK('Customers'[Cust ID])

I want to create a measure that will tell me the average customers for the entire team.  So the average customer count for Jon Vander's team and Garven Dreis.  So the In Garven Dreis's team, the average customer count should be (6+3+3)/3 = 4.

I'm trying to create cards that the individual can look at.  So if Briggs Darklighter gets to the page and selects his name in the slicer, he'll have a card that tells him his total customers (6) and another card that says average team customer count (4)

1 ACCEPTED SOLUTION
Community Support

Hi @careisin60 ,

You may try these Measures.

1 Measure that calculates total customer of selected member

``````CountCustForMember =
CALCULATE (
DISTINCTCOUNT ( Customers[Cust ID] ),
ALLEXCEPT ( Customers, Customers[Team Member] )
)
``````

2 Measure that calculates average team customer

``````AvgCustOfTeam =
CALCULATE (
COUNT ( Customers[Cust ID] ),
FILTER (
ALL ( Customers ),
)
)
VAR CountMember =
CALCULATE (
DISTINCTCOUNT ( Customers[Team Member] ),
FILTER (
ALL ( Customers ),
)
)
VAR Result =
ROUNDDOWN ( DIVIDE ( CustCountByLeader, CountMember ), 0 )
RETURN
Result
``````

Then, the result will look like this.

Also, attached the pbix file as reference.

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

Best Regards,

Community Support Team _ Caiyun

5 REPLIES 5
Community Support

Hi @careisin60 ,

You may try these Measures.

1 Measure that calculates total customer of selected member

``````CountCustForMember =
CALCULATE (
DISTINCTCOUNT ( Customers[Cust ID] ),
ALLEXCEPT ( Customers, Customers[Team Member] )
)
``````

2 Measure that calculates average team customer

``````AvgCustOfTeam =
CALCULATE (
COUNT ( Customers[Cust ID] ),
FILTER (
ALL ( Customers ),
)
)
VAR CountMember =
CALCULATE (
DISTINCTCOUNT ( Customers[Team Member] ),
FILTER (
ALL ( Customers ),
)
)
VAR Result =
ROUNDDOWN ( DIVIDE ( CustCountByLeader, CountMember ), 0 )
RETURN
Result
``````

Then, the result will look like this.

Also, attached the pbix file as reference.

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

Best Regards,

Community Support Team _ Caiyun

Super User

Would like to show the average instead of the subtotal?

Frequent Visitor

Yeah, I want Jon Vander to be able to talk to Davish Krail about being below the average for the team and Keyan Farlander about being above the team average.

Super User

Hi @careisin60 ,
Here is the file with the solution https://www.dropbox.com/t/OGE09jZvurSG1nAI
The code is simple

``````Count of Cust ID =
VAR CustSum =
DISTINCTCOUNTNOBLANK ( Customers[Cust ID] )
VAR NumberOfMembers =
COUNTROWS ( VALUES ( Customers[Team Member] ) )
VAR Result =
DIVIDE ( CustSum, NumberOfMembers )
RETURN
Result``````
Resolver II

Hi @careisin60, something like this?:

`Average Customers = VAR TeamLeader = MAX('Table'[Team Leader])VAR TeamLeaderCustomerCount = CALCULATE([Count of Cust ID], ALL('Table'[Team Member]), 'Table'[Team Leader] = TeamLeader)VAR TeamMemberCount = CALCULATE(DISTINCTCOUNT('Table'[Team Member]), ALL('Table'[Team Member]), 'Table'[Team Leader] = TeamLeader)RETURNDIVIDE(TeamLeaderCustomerCount, TeamMemberCount)`

EDIT: I was correct the first time

Announcements

#### Join Arun Ulag at MPPC23

Get a sneak peek into this year's Power Platform Conference Keynote.

#### Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

#### Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

#### Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Top Solution Authors
Top Kudoed Authors