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
sdgiss
Helper I
Helper I

Weekly group average

Hello all,

 

I am hoping someone can help me with calculating a weekly average for a group. The following returns the sum of the weekly totals for all of the racers who were competing in that respective week (which is the result I get when dropping [Total Dist] into the pivot table by itself). The desired value is next to Fall-Week01 for both 2019 and 2020. I believe I need a count of athletes per week to get to the outcome I desire, but that is proving difficult as well. The second measure is close but I get the same racer count (total of all racers in database) for each week even though the total number of racers per week never tops 24 in 2020.

 

Thank you, in advance, for the help!

 

Weekly average dist:=AVERAGEX(VALUES(dDate[WeekNum]),[Total Dist])

Weekly Average Dist-distinctcount:=DIVIDE(AVERAGEX(VALUES(dDate[WeekNum]), [Total Dist]),DISTINCTCOUNT(dRacer[Racer]))

 

Screen Shot 2020-10-31 at 11.35.32 PM.png

1 ACCEPTED SOLUTION
AlB
Super User
Super User

Hi @sdgiss 

To get an accurate answer, you'd need to show your data model, the tables relevant to these calculations and their relationships. If dRace is a dimension table, you have to do the distinctcount on the fact table where the info on the races is, since that will (supposedly) be filtered by the week number. Assuming [Total Dist] works correctly, try something like:

Measure =

DIVIDE( [Total Dist], DISTINCTCOUNT(FactTable[RacerID])

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

View solution in original post

2 REPLIES 2
AlB
Super User
Super User

Hi @sdgiss 

To get an accurate answer, you'd need to show your data model, the tables relevant to these calculations and their relationships. If dRace is a dimension table, you have to do the distinctcount on the fact table where the info on the races is, since that will (supposedly) be filtered by the week number. Assuming [Total Dist] works correctly, try something like:

Measure =

DIVIDE( [Total Dist], DISTINCTCOUNT(FactTable[RacerID])

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

Thank you @AlB! Your answer makes complete sense and have should have seen this when posting my question. It is such a simple solution, yet my narrow view of how this should work was blocking my ability to think clearly. I've gotten so caught up in always using my dimension tables that I forget about how, in some instances, they don't apply.

 

Have a great week!

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.

Top Solution Authors