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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Kopek
Helper IV
Helper IV

Sum Sales Average per selected period

Hi !

I have a daily snapshot of sales data, i am trying to count the average of sum of sales for last 4 and 12 weeks.

Unfortunately i am ending up having a 4weeks daily average for some reason... can somebody help me sorting that issue.

in this case last 4 week average should be 688929. And due to daily snapshot i have 19.29...

Kopek_0-1734017279026.png

 

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

Try

Last 4 weeks average =
VAR Weeks =
    CALCULATETABLE (
        VALUES ( 'Date'[Year-week] ),
        DATESINPERIOD ( 'Date'[Date], MAX ( 'Date'[Date] ), -28, DAY )
    )
VAR Result =
    AVERAGEX (
        Weeks,
        CALCULATE ( SUM ( 'Table'[Sales] ), ALLEXCEPT ( 'Date', 'Date'[Year-week] ) )
    )
RETURN
    Result

View solution in original post

2 REPLIES 2
johnt75
Super User
Super User

Try

Last 4 weeks average =
VAR Weeks =
    CALCULATETABLE (
        VALUES ( 'Date'[Year-week] ),
        DATESINPERIOD ( 'Date'[Date], MAX ( 'Date'[Date] ), -28, DAY )
    )
VAR Result =
    AVERAGEX (
        Weeks,
        CALCULATE ( SUM ( 'Table'[Sales] ), ALLEXCEPT ( 'Date', 'Date'[Year-week] ) )
    )
RETURN
    Result
lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.

Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.