Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
mjholland
Helper II
Helper II

Calculate Average of an Average Measure

Hi,

 

I have data for a number of team members showing the start time of visits they made to customers each day for the full year. These team members are divided into a number of teams.

 

I've been able to use the following DAX measure to find out the average start time for each team members, which can be used across each week of the year:

 

AvgStartTime = VAR Result = AVERAGEX ( VALUES ( 'TITO Data'[EntryDate] ), CALCULATE ( MIN ( 'TITO Data'[EntryTime]) ) ) RETURN IF ( NOT ( ISBLANK ( Result ) ), Result + TIME ( 0, 0, 0 ) )

 

This works out the earliest start for each day and takes an average.


This formula works fine when I have a table with each team member in a row but when I try to show what the average start time is across the entire team the results are not correct and I don't know why or how to fix it. Should I be trying to take an average of teh AvgStartTime measure or do I need to do something completely different?

 

Can anyone help?

 

mjholland

1 ACCEPTED SOLUTION
v-haibl-msft
Employee
Employee

@mjholland

 

You can try to create a summarize table with following formula, then create a simple measure to calculate the team average.

 

Table = 
SUMMARIZECOLUMNS (
    'TITO Data'[Team],
    'TITO Data'[Team Member],
    'TITO Data'[Customer],
    'TITO Data'[EntryDate],
    "MinEntryTime", MIN ( 'TITO Data'[EntryTime] )
)
AvgStartTime_Team = 
VAR Result =
    AVERAGE ( 'Table'[MinEntryTime] )
RETURN
IF ( NOT ( ISBLANK ( Result ) ), Result + TIME ( 0, 0, 0 ) )

Calculate Average of an Average Measure_1.jpg

 

Best Regards,

Herbert

View solution in original post

3 REPLIES 3
v-haibl-msft
Employee
Employee

@mjholland

 

You can try to create a summarize table with following formula, then create a simple measure to calculate the team average.

 

Table = 
SUMMARIZECOLUMNS (
    'TITO Data'[Team],
    'TITO Data'[Team Member],
    'TITO Data'[Customer],
    'TITO Data'[EntryDate],
    "MinEntryTime", MIN ( 'TITO Data'[EntryTime] )
)
AvgStartTime_Team = 
VAR Result =
    AVERAGE ( 'Table'[MinEntryTime] )
RETURN
IF ( NOT ( ISBLANK ( Result ) ), Result + TIME ( 0, 0, 0 ) )

Calculate Average of an Average Measure_1.jpg

 

Best Regards,

Herbert

Hi @v-haibl-msft, this looks like it's working.

 

I've actually now created a summary table in QueryEditor to bring in additional information I'll need to report on by team then used the second measure to get the average I needed.

 

Thanks for your help,

mjholland

Greg_Deckler
Super User
Super User

Can you post some sample data so that we can recreate it, observe the issue and then come up with a fix.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.