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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Dwalden
Regular Visitor

Creating a 4 Week Average

Hello everyone!

I am new to the PowerBi community. Ultimately, I have a table where I am counting the total records and want to average this out over the past 4 weeks. For example, over the past 4 weeks, what is the average number of records? 

To build on this, I would love to have a measure that looks at this same time period but at the previous year. I am trying to create a table that shows this years last 4 weeks compared to last year and shows if we are doing better or worse. 

Any feedback on how to accomplish this would be fantastic! 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Dwalden 

 

Based on your needs, I have created the following table.

vjialongymsft_0-1710302452680.png

 

You can use the following dax to get the weekly average for the last four weeks and the weekly average for the same period last year.

Average Last 4 Weeks = 
CALCULATE (
    SUM ( 'Table'[Column1] ),
    FILTER (
        'Table',
        'Table'[date]
            >= DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ), DAY ( TODAY () ) - 28 )
    )
) / 4

 

Average Last 4 Weeks Last Year = 
CALCULATE (
    SUM ( 'Table'[Column1] ),
    FILTER (
        'Table',
        'Table'[date]
            >= DATE ( YEAR ( TODAY () - 1 ), MONTH ( TODAY () ), DAY ( TODAY () ) - 28 )
            && 'Table'[date]
                < DATE ( YEAR ( TODAY () - 1 ), MONTH ( TODAY () ), DAY ( TODAY () ) )
    )
) / 4

 

You can use the following dax to determine if you are doing better or worse.

Measure = IF([Average Last 4 Weeks]>=[Average Last 4 Weeks Last Year],"better","worse")

 

This is the result you want.

vjialongymsft_1-1710303109091.png

 

 

 

Best Regards,

Jayleny

 

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 @Dwalden 

 

Based on your needs, I have created the following table.

vjialongymsft_0-1710302452680.png

 

You can use the following dax to get the weekly average for the last four weeks and the weekly average for the same period last year.

Average Last 4 Weeks = 
CALCULATE (
    SUM ( 'Table'[Column1] ),
    FILTER (
        'Table',
        'Table'[date]
            >= DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ), DAY ( TODAY () ) - 28 )
    )
) / 4

 

Average Last 4 Weeks Last Year = 
CALCULATE (
    SUM ( 'Table'[Column1] ),
    FILTER (
        'Table',
        'Table'[date]
            >= DATE ( YEAR ( TODAY () - 1 ), MONTH ( TODAY () ), DAY ( TODAY () ) - 28 )
            && 'Table'[date]
                < DATE ( YEAR ( TODAY () - 1 ), MONTH ( TODAY () ), DAY ( TODAY () ) )
    )
) / 4

 

You can use the following dax to determine if you are doing better or worse.

Measure = IF([Average Last 4 Weeks]>=[Average Last 4 Weeks Last Year],"better","worse")

 

This is the result you want.

vjialongymsft_1-1710303109091.png

 

 

 

Best Regards,

Jayleny

 

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

This is great! I think I have a new issue, or use case. I am wanting to use a date slicer to pull in the correct row counts. Example, I have one table of data and a new date table I created. Based on what my slicer is set, I would like to have the row count in one measure and then have the comparison dates from last year in the second measure. So, if I set my slicer to look at the last 4 weeks, I would love it to count these and then in another measure count the same period last year as those dates. Is there a way to accomplish this? Thanks so much!

Power BI Image Example.png

Above, I want a measure next the 777 look at the same period referencing the slicer so I can make a dynamic difference calculation

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.