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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
ebrownretail
Resolver I
Resolver I

Average sales for upcomign weeks

Hi!

I am new to Power BI and trying to build this to help manage inventory. We are a seasonal item, so we have very large humps in our sales progression during certain seasons. Due to this, i need to be able to pull the sales average from previous years, but i need this for upcoming weeks.

 

Example:

I need to make sure i have enough product to cover expected sales in the upcoming weeks. I need the average for the below week(s) to know what I need. Any ideas on how i can do this? I work with a 4-4-5 retail calendar so i do not have the same number of week each year.

 

Currently Week 24 - Need Week 25 avg + 26 avg for the previous years in my sales table.

2 ACCEPTED SOLUTIONS

Thank you for the reply! i was wondering if there is a way to do this without designating specific weeks? The week numbers will obviously change as the year progresses, and i dont want to have to edit the measure everytime.

 

Is it possible to have this do all week numbers, and then i can narrow down with a slicer to the specific week numbers i want?

View solution in original post

Anonymous
Not applicable

Hi @ebrownretail ,

 

I suggest you to try New Parameter feature to create a weeknum slicer.

For reference: Use parameters to visualize variables - Power BI | Microsoft Learn

Then update your measure as below.

AverageWeek =
VAR _SELECTWEEK =
    SELETEDVALUE ( 'WeekNum'[Week] )
VAR _Avg1 =
    CALCULATE (
        AVERAGEX (
            VALUES ( DateTable[Year] ),
            CALCULATE ( [TotalSales], DateTable[Week] = _SELECTWEEK + 1 )
        ),
        ALL ( DateTable[Year] )
    )
VAR _Avg2 =
    CALCULATE (
        AVERAGEX (
            VALUES ( DateTable[Year] ),
            CALCULATE ( [TotalSales], DateTable[Week] = _SELECTWEEK + 2 )
        ),
        ALL ( DateTable[Year] )
    )
RETURN
    _Avg1 + _Avg2

 

Best Regards,
Rico Zhou

 

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
hackcrr
Memorable Member
Memorable Member

Hi, @ebrownretail 

Ensure your sales data includes a date column, sales amount, and a column that identifies the week of the 4-4-5 calendar.
Create a date table that follows the 4-4-5 calendar. This table should include columns for the date, year, week number, and any other relevant periods (e.g., quarter, month).

DateTable = 
ADDCOLUMNS(
    CALENDAR("Start Date", "End Date"),
    "Year", YEAR([Date]),
    "Month", MONTH([Date]),
    "Week", WEEKNUM([Date])
)


Create a relationship between your sales table and the date table based on the date columns.
Calculate Weekly Sales:

TotalSales = SUM(Sales[SalesAmount])

Create a measure to calculate total sales for each week:

AverageWeek25 = 
CALCULATE(
    AVERAGEX(
        VALUES(DateTable[Year]), 
        CALCULATE(
            [TotalSales], 
            DateTable[Week] = 25
        )
    ),
    ALL(DateTable[Year])
)

AverageWeek26 = 
CALCULATE(
    AVERAGEX(
        VALUES(DateTable[Year]), 
        CALCULATE(
            [TotalSales], 
            DateTable[Week] = 26
        )
    ),
    ALL(DateTable[Year])
)

Combine the measures for forecasting the total required sales for the upcoming weeks:

ForecastWeek25_26 = [AverageWeek25] + [AverageWeek26]

Use a card or table visualization to display the forecasted sales for Week 25 and Week 26 based on the averages from previous years.

 

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

Thank you for the reply! i was wondering if there is a way to do this without designating specific weeks? The week numbers will obviously change as the year progresses, and i dont want to have to edit the measure everytime.

 

Is it possible to have this do all week numbers, and then i can narrow down with a slicer to the specific week numbers i want?

Anonymous
Not applicable

Hi @ebrownretail ,

 

I suggest you to try New Parameter feature to create a weeknum slicer.

For reference: Use parameters to visualize variables - Power BI | Microsoft Learn

Then update your measure as below.

AverageWeek =
VAR _SELECTWEEK =
    SELETEDVALUE ( 'WeekNum'[Week] )
VAR _Avg1 =
    CALCULATE (
        AVERAGEX (
            VALUES ( DateTable[Year] ),
            CALCULATE ( [TotalSales], DateTable[Week] = _SELECTWEEK + 1 )
        ),
        ALL ( DateTable[Year] )
    )
VAR _Avg2 =
    CALCULATE (
        AVERAGEX (
            VALUES ( DateTable[Year] ),
            CALCULATE ( [TotalSales], DateTable[Week] = _SELECTWEEK + 2 )
        ),
        ALL ( DateTable[Year] )
    )
RETURN
    _Avg1 + _Avg2

 

Best Regards,
Rico Zhou

 

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

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

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.