cancel
Showing results for
Did you mean:

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

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

#### Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

#### Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

#### The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors