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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Calculate the weekly average of a measurement

Hello,

 

I have this measure to calculate the number of distinct users per day who visit the reports. However I have to make a weekly average taking into account the five working days without the weekends. I guess I might need a calendar table that will be linked to the date field of my tf_audit table. Can you help me? 

 

 

# Audit.Vues =

var _table=SUMMARIZE(TF_AUDIT,TF_AUDIT[Audit.WorkspaceId],"distinctcount",DISTINCTCOUNT(TF_AUDIT[Audit.UserKey]))

return
SUMX(_table,[distinctcount])
 
 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

I have created a simple sample, please refer to it to see if it helps you.

Create columns about weeknumber and weekday.

WEEKDAY = WEEKDAY(TF_AUDIT[date],1)
WEEKNUM = WEEKNUM(TF_AUDIT[date],1)
Measure =
CALCULATE (
    AVERAGE ( TF_AUDIT[Audit.UserKey] ),
    FILTER (
        ALL ( TF_AUDIT ),
        TF_AUDIT[WEEKNUM] = SELECTEDVALUE ( TF_AUDIT[WEEKNUM] )
            && TF_AUDIT[WEEKDAY] <= 5
    )
)

vpollymsft_1-1652336638696.png

 

 

If I have misunderstood your meaning, please provide your pbix file without privacy information and your desired output.

 

Best Regards
Community Support Team _ Polly

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous ,

I have created a simple sample, please refer to it to see if it helps you.

Create columns about weeknumber and weekday.

WEEKDAY = WEEKDAY(TF_AUDIT[date],1)
WEEKNUM = WEEKNUM(TF_AUDIT[date],1)
Measure =
CALCULATE (
    AVERAGE ( TF_AUDIT[Audit.UserKey] ),
    FILTER (
        ALL ( TF_AUDIT ),
        TF_AUDIT[WEEKNUM] = SELECTEDVALUE ( TF_AUDIT[WEEKNUM] )
            && TF_AUDIT[WEEKDAY] <= 5
    )
)

vpollymsft_1-1652336638696.png

 

 

If I have misunderstood your meaning, please provide your pbix file without privacy information and your desired output.

 

Best Regards
Community Support Team _ Polly

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Anonymous
Not applicable

hello thank you but it doesn't work in my case. I need to count the weekly average number of views per report. To help: one row = one view if the profile activity column = "Reader" I need to count the number of rows with "Reader" then make the weekly average of this number.

I make an example below of my table. The weekly average of the rows concerning the reader profiles must be done. Do not take into account the others as analyst. I have to sum the 1's of the volume column and calculate the weekly average and why per month if possible if we can make it dynamic.

I can only have one line max per person per report per day.

 

PROFILVolume ViewDateNameREPORT
READER102/01/2022JackSells

READER

103/01/2022JackSells

READER

102/01/2022TomSells

ANALYSTE

102/01/2022LisaSells
amitchandak
Super User
Super User

@Anonymous , Have these columns in table or date table

Start Year = STARTOFYEAR('Date'[Date],"3/31")
WeekDay = WEEKDAY([Date],2) //monday
Start of Week = [Date] -[WeekDay]+1 //monday
FY Year = YEAR('Date'[Start Year]) // use end year
FY Week = QUOTIENT(DATEDIFF(Minx(FILTER('Date',[FY Year]=EARLIER([FY Year])),'Date'[Start of Week]),[Date],DAY),7)+1

Work Day = if(WEEKDAY([Date],2)>=6,0,1)

 

# Audit.Vues =
AverageX(values('Date'[Start of Week]) ,calculate(DISTINCTCOUNT(TF_AUDIT[Audit.UserKey]), filter('Date','Date'[Work Day] =1) ) )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.