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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Junminkim0214
Frequent Visitor

Enquiry on Rolling Average (Average of last 4 weeks sales qty)

Hey PBI experts! 😄

I'm trying to have a 4 week rolling average of CS qty but couldn't find solutions yet. There are many related articles but the advices don't work out for me. I think it's because the data doesn't have any actual dates.

 

All I need is a column that shows the average of the previous 4 weeks. Could you please advice? Thanks a lot!

 

Input data

Junminkim0214_0-1660552677012.png

 

 

@amitchandak  @lbendlin  @SpartaBI  @tamerj1  @ray_ux 

 

 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hello Again @Junminkim0214 
This is the running average per Matrial

=
VAR CurrentWeek = TableName[Calendar Week]
VAR StartWeek = CurrentWeek - 4
RETURN
    CALCULATE (
        AVERAGE ( TableName[CS Qty] ),
        TableName[Calendar Week] <= CurrentWeek,
        TableName[Calendar Week] > StartWeek,
        ALLEXCEPT ( TableName, TableName[Material] )
    )

View solution in original post

3 REPLIES 3
v-jianboli-msft
Community Support
Community Support

Hi @Junminkim0214 ,

 

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or if you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.

 

Refer to:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

 

Best Regards,

Jianbo Li

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

tamerj1
Super User
Super User

Hello Again @Junminkim0214 
This is the running average per Matrial

=
VAR CurrentWeek = TableName[Calendar Week]
VAR StartWeek = CurrentWeek - 4
RETURN
    CALCULATE (
        AVERAGE ( TableName[CS Qty] ),
        TableName[Calendar Week] <= CurrentWeek,
        TableName[Calendar Week] > StartWeek,
        ALLEXCEPT ( TableName, TableName[Material] )
    )
tamerj1
Super User
Super User

Hi @Junminkim0214 
Do you want that per material, per customer or per both customer and material?

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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