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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
o-man
New Member

4 week running average based on the slicer for a specific employee

How do I create a chart that shows a 4 week average based on today's date and an employee that the end user selects from a slicer?

 

The data has scores for people's performance (0-10) by day but would like to show the average of those scores by week but based on the selection of the end user's choice of employee.  I'd like the end user to be able to select one or more employees to see each of their 4 week running average against each other to compare. 

 

I may want to run the 4 week average based on today through the same time 4 weeks ago or based on the end of last week through 4 weeks earlier.  How are each of those written?

 

Is there something I need to do with my data to set it up correctly for this?  Do I need to manually create a date table versus using the embedded on in Power BI?

 

Thanks in advance.

3 REPLIES 3
ankitpatira
Community Champion
Community Champion

@o-man Considering you have data as shown below,

 

Capture.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1. Make duplicate of date column and extract month of it as shown below and rename column as Month.

 

Capture.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

2. Similary make another duplicate of date column and extract Week of Month and rename column as WeekofMonth.

 

3. Your dataset should look like below.

 

Capture.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

4. Next highlight WeekofMonth column, right click and click Group By. Group By dialog box should look like below,

 

Capture.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

5. Finally Close & Apply.

 

Now you can choose Month, WeekofMonth and People column as slicers on report and create a table of those columns along with AvgPerf column. 

 

 

Thank you @ankitpatira.  I really appreciate it.  I'll take a crack at it today and let you all know.

@o-man

 

You can also do it with DAX query. If you have data as below. You can create several measures to get 4 week average based on today or 4 weeks ago based on the end of last week.

 

1.png

 

2.png

 

Measures need to be created:

 

Date4weeksAgo(Based on today) = TODAY() -27

 

TotalDays = DATEDIFF([Date4weeksAgo(Based on today)], TODAY(), DAY) + 1

 

4weeksSumPerf =

CALCULATE (

    SUM ( Performance[Performance] ),

    FILTER (

        Performance,

        AND (

            Performance[Date] >= [Date4weeksAgo(Based on today)],

            Performance[Date] <= TODAY()

        )

    )

)

 

4weeksAvePerf = [4weeksSumPerf] / [TotalDays]

 

For 4 weeks ago based on the end of last week (assume week begins on Sunday and ends on Saturday), you just need to create a new measure. Then replace “[Date4weeksAgo(Based on today)]” with “[Date4weeksAgo(based on the end of last week)]” in above Measure2 and 3.

 

Date4weeksAgo(based on the end of last week) = TODAY() - WEEKDAY(TODAY()) – 27

 

Regards,

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Solution Authors