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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
anandita
Regular Visitor

Calculate rolling average for future 7 days

Hi . I want to generate forecast which is 7 days rolling average of past days. This forecast should be generated for next 7 days based on latest date in [MV_START_DT_NEW] column . The average should be generated by grouping cluster , plant and product description. Below is the data sample and expected output columns highlighted in yellow

 

 

Cluster_newGSAP_PLANT_MAPPEDProduct DescriptionMV_START_DT_NEWSum_Inv (BBL)Forecasted valueFuture forecast dates
NYHNEY826ETHANOL5/17/2024-119.380952410.337210885/24/2024
NYHNEY826ETHANOL5/18/2024-133.571428610.337210885/25/2024
NYHNEY826ETHANOL5/19/2024-134.833333310.337210885/26/2024
NYHNEY826ETHANOL5/20/2024-137.738095210.337210885/27/2024
NYHNEY826ETHANOL5/21/2024-195.476190510.337210885/28/2024
NYHNEY826ETHANOL5/22/2024920.690476210.337210885/29/2024
NYHNEY826ETHANOL5/23/2024-127.3310.337210885/30/2024
RG3SWY001PUL5/17/2024108.59523815.645/24/2024
RG3SWY001PUL5/18/2024-39.047619055.645/25/2024
RG3SWY001PUL5/19/2024-30.880952385.645/26/2024
RG3SWY001PUL5/20/202426.40476195.645/27/2024
RG3SWY001PUL5/21/2024-173.0476195.645/28/2024
RG3SWY001PUL5/22/2024193.02380955.645/29/2024
RG3SWY001PUL5/23/2024-124.5476195.645/30/2024
COLOY01QDIESEL5/17/2024-401.78571431495/24/2024
COLOY01QDIESEL5/18/2024-70.880952381495/25/2024
COLOY01QDIESEL5/19/2024-122.19047621495/26/2024
COLOY01QDIESEL5/20/2024-129.64285711495/27/2024
COLOY01QDIESEL5/21/2024-193.26190481495/28/2024
COLOY01QDIESEL5/22/2024-44.619047621495/29/2024
COLOY01QDIESEL5/23/2024-83.709523811495/30/2024
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @anandita,

You can try to use the following measure formulas if it sutiabel for your requirement:

Rolling AVG =
VAR currDate =
    MAX ( Table1[MV_START_DT_NEW] )
RETURN
    AVERAGEX (
        SUMMARIZE (
            FILTER ( ALLSELECTED ( Table1 ), [MV_START_DT_NEW] <= currDate - 7 ),
            [Cluster_new],
            [GSAP_PLANT_MAPPED],
            [Product Description],
            "Total", SUM ( Table[Sum_Inv (BBL)] )
        ),
        [Total]
    )

Regards,

Xiaoxin Sheng

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @anandita,

You can try to use the following measure formulas if it sutiabel for your requirement:

Rolling AVG =
VAR currDate =
    MAX ( Table1[MV_START_DT_NEW] )
RETURN
    AVERAGEX (
        SUMMARIZE (
            FILTER ( ALLSELECTED ( Table1 ), [MV_START_DT_NEW] <= currDate - 7 ),
            [Cluster_new],
            [GSAP_PLANT_MAPPED],
            [Product Description],
            "Total", SUM ( Table[Sum_Inv (BBL)] )
        ),
        [Total]
    )

Regards,

Xiaoxin Sheng

Thank you for responding @Anonymous . However I am not able to plot this measure and getting below error 

anandita_0-1717424185321.png

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors