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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It 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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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