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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
markbell
Frequent Visitor

Average Number of People per Day of Week

Hi all,

 

I have a list of people names along with the dates that they are onsite for (I work for a mining company). What I would like to do is summarize this data by calculating the average number of people onsite for each and every day (ie Sun, Mon, ...) over a filtered timeframe.

 

My data looks something like this:

Data.png

 

I would like to produce a graph that shows the average number of people onsite for each day of the week with filters (slicers) below it for Year, Quarter, Month, etc

 

I'm new to Power BI and am excited at the possibilities! 🙂

 

Many thanks in advance.

3 ACCEPTED SOLUTIONS
samdthompson
Memorable Member
Memorable Member

OK, welcome aboard.

 

First you will need a date table to join to. Once you do, any of your time based functions should refer to that. Make sure your date table has all those dimensions you want.

Secondly you will need to write a measure. I suspect you will need something like:

      Head_count=countrows(table)

this will give you the total number of people on site which once sliced by day etc will give you a per day number.

 

The sky is the limit with what you might then want to do. You might want people visiting YTD (i did when i was at a mine). The answer is to use the date table eg: Total_calendar_YTD =TOTALYTD(Head_count,datetbl[date])

 

 

// If this solves your question please mark as solved

 

 

 

// if this is a solution please mark as such. Kudos always appreciated.

View solution in original post

Vvelarde
Community Champion
Community Champion

 

To create a date table you can use this sample:

 

In Modeling--New Table

 

DateTable =
ADDCOLUMNS (
CALENDAR ( "01/01/2000";"31/12/2017");
"Year"; YEAR ( [Date] );
"Monthnumber"; FORMAT ( [Date]; "MM" );
"MonthNameLong"; FORMAT ( [Date]; "mmmm" );
"DayOfWeekNumber"; WEEKDAY ( [Date] );
"DayOfWeek"; FORMAT ( [Date]; "dddd" );
"Quarter"; "Q" & FORMAT ( [Date]; "Q" )
)




Lima - Peru

View solution in original post

if you chart against the day of the week then you will have the average for the day etc. The total will be the total.

 

 

// If this solves your question please mark as solved

// if this is a solution please mark as such. Kudos always appreciated.

View solution in original post

8 REPLIES 8
Vvelarde
Community Champion
Community Champion

 

To create a date table you can use this sample:

 

In Modeling--New Table

 

DateTable =
ADDCOLUMNS (
CALENDAR ( "01/01/2000";"31/12/2017");
"Year"; YEAR ( [Date] );
"Monthnumber"; FORMAT ( [Date]; "MM" );
"MonthNameLong"; FORMAT ( [Date]; "mmmm" );
"DayOfWeekNumber"; WEEKDAY ( [Date] );
"DayOfWeek"; FORMAT ( [Date]; "dddd" );
"Quarter"; "Q" & FORMAT ( [Date]; "Q" )
)




Lima - Peru

Hi all - thank you.

 

I have successfully created a date table using the following:

  

tblDate = ADDCOLUMNS(CALENDAR("1-jan-2000","31-dec-2025"),"DateAsInteger",format([Date],"YYYYMMDD"),"Year",year([Date]), "Monthnumber", FORMAT ( [Date], "MM" ),"YearMonthnumber", FORMAT ( [Date], "YYYY/MM" ), "YearMonthShort", FORMAT ( [Date], "YYYY/mmm" ),"MonthNameShort", FORMAT ( [Date], "mmm" ), "MonthNameLong", FORMAT ( [Date], "mmmm" ),"DayOfWeekNumber", WEEKDAY ( [Date] ), "DayOfWeek", FORMAT ( [Date], "dddd" ),"DayOfWeekShort", FORMAT ( [Date], "ddd" ), "Quarter", "Q" & FORMAT ( [Date], "Q" ),"YearQuarter", FORMAT ( [Date], "YYYY" ) & "/Q" & FORMAT ( [Date], "Q" ))

 

and have also created the Total_calendar_YTD measure and graphed it. I am still struggling to work out how to average the number of people that are onsite for each and every day of the week. Do you have any formulas for that?

 

Thanks again.

Average_head=AVERAGEX(Table,COUNTROWS(Table))

 

 

// If this solves your question please mark as solved

// if this is a solution please mark as such. Kudos always appreciated.

Hi samdthompson

 

With the dataset that I have, the Average_head function returns the same number as the Total_calendar_YTD.

 

if you chart against the day of the week then you will have the average for the day etc. The total will be the total.

 

 

// If this solves your question please mark as solved

// if this is a solution please mark as such. Kudos always appreciated.

Do you have any screenshots that you can post as I'm getting completely lost now. 😞

Hi all,

 

I've managed to get it working using the following measure:

 

Avg_Count = DIVIDE(COUNTROWS(onsite),DISTINCTCOUNT(Onsite[RosterDate]))

 

Thanks for everyone's help.

samdthompson
Memorable Member
Memorable Member

OK, welcome aboard.

 

First you will need a date table to join to. Once you do, any of your time based functions should refer to that. Make sure your date table has all those dimensions you want.

Secondly you will need to write a measure. I suspect you will need something like:

      Head_count=countrows(table)

this will give you the total number of people on site which once sliced by day etc will give you a per day number.

 

The sky is the limit with what you might then want to do. You might want people visiting YTD (i did when i was at a mine). The answer is to use the date table eg: Total_calendar_YTD =TOTALYTD(Head_count,datetbl[date])

 

 

// If this solves your question please mark as solved

 

 

 

// if this is a solution please mark as such. Kudos always appreciated.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.