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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Syndicate_Admin
Administrator
Administrator

Cumulative average per week

hello
I need your help to create a measure and thus obtain the value of the accumulated average per week, this measure I have tried to create in many ways without any success. My tbla is configured as follows with the following measurements:

Average condition = SUM('Sampling Indicators'[sumCondition])/SUM('Process Sampling' [General Count]) *100
Average soft fruit indicator =SUM('Indicator Sampling'[sumSoftfruit])/SUM('Process Sampling'[ConteoGeneral]) *100
Average Linear Indicator = ([Average condition]+ [Average Soft Fruit Gauge])/2



wzuniga_0-1736476060575.png

I leave Excel with TBLA data structure
Indicadores.xlsx sampling


The expected result
for week 44: 91.67)/1
for week 45: (91.67+ 92.40)/2
for week 46: (91.67+ 92.40+95.46)/3
and so on...

I thank you for all your support and experience, thank you!

2 ACCEPTED SOLUTIONS
Jihwan_Kim
Super User
Super User

Hi,

I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

One of ways to achieve this is to use WINDOW DAX function in the measure.

 

Jihwan_Kim_1-1736481362201.png

 

 

Jihwan_Kim_0-1736481352080.png

 

 

WINDOW function (DAX) - DAX | Microsoft Learn

 

 

 

expected result: =
VAR _t =
    ADDCOLUMNS (
        WINDOW (
            1,
            ABS,
            0,
            REL,
            ALL ( 'calendar'[Year-Month], 'calendar'[Year-Month sort] ),
            ORDERBY ( 'calendar'[Year-Month sort], ASC )
        ),
        "#avgsalespermonth", [average sales per month:]
    )
VAR _countrows =
    COUNTROWS ( _t )
RETURN
    IF (
        NOT ISBLANK ( [average sales per month:] ),
        SUMX ( _t, [#avgsalespermonth] ) / _countrows
    )

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

View solution in original post

Anonymous
Not applicable

Hi @Syndicate_Admin ,

I very much recognize Jihwan_Kim's idea, but I created a form just the same.

vyilongmsft_0-1736736247730.png

So I think you can create a calculated column and here is the DAX code.

Column = 
VAR CurrentRow = 'Table'[Number]
RETURN
    DIVIDE(
        SUMX(
            FILTER(
                'Table',
               'Table'[Number] <= CurrentRow
            ),
            'Table'[Value]
        ),
        CurrentRow
    )

vyilongmsft_1-1736736499943.png

 

 

Best Regards

Yilong 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

2 REPLIES 2
Anonymous
Not applicable

Hi @Syndicate_Admin ,

I very much recognize Jihwan_Kim's idea, but I created a form just the same.

vyilongmsft_0-1736736247730.png

So I think you can create a calculated column and here is the DAX code.

Column = 
VAR CurrentRow = 'Table'[Number]
RETURN
    DIVIDE(
        SUMX(
            FILTER(
                'Table',
               'Table'[Number] <= CurrentRow
            ),
            'Table'[Value]
        ),
        CurrentRow
    )

vyilongmsft_1-1736736499943.png

 

 

Best Regards

Yilong Zhou

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

Jihwan_Kim
Super User
Super User

Hi,

I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

One of ways to achieve this is to use WINDOW DAX function in the measure.

 

Jihwan_Kim_1-1736481362201.png

 

 

Jihwan_Kim_0-1736481352080.png

 

 

WINDOW function (DAX) - DAX | Microsoft Learn

 

 

 

expected result: =
VAR _t =
    ADDCOLUMNS (
        WINDOW (
            1,
            ABS,
            0,
            REL,
            ALL ( 'calendar'[Year-Month], 'calendar'[Year-Month sort] ),
            ORDERBY ( 'calendar'[Year-Month sort], ASC )
        ),
        "#avgsalespermonth", [average sales per month:]
    )
VAR _countrows =
    COUNTROWS ( _t )
RETURN
    IF (
        NOT ISBLANK ( [average sales per month:] ),
        SUMX ( _t, [#avgsalespermonth] ) / _countrows
    )

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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

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.