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
jnd27
New Member

Running Average with measure and no date

Hi, I have 2 data tables and a date index table which is as followed: January | 1 February | 2 March | 3 ... December | 12 those 2 tables are connected by the above index numbers. Those tables have $ values and an index column as well that I made to make the relationship. My question is how I can do a running ratio average, a measure made in a separate measures table. For example:
Table 1
1 | $500 2 | $300 3 | $100
Table 2
1 | $200 2 | $400 3 | $0
I want a line chart showing running averages of the $ values by index in a calculation of Table1 divided by Table2 the values I want would be 5/2, then 8/6 --> (500+300/(200+400)), and 3 would be 9/6 --> (500+300+100)/(200+400+0) I have tried a bunch of online solutions but none have both of the conditions of using a a numeric index and using a custom measure in the running average, I was able to do a line but not able to add in the measure through VARs+calculate+sumx. Thanks so much

1 ACCEPTED SOLUTION

Hi,

In the sample pbix file, please try to write a measure something like below.

 

Expected result measure V2: =
VAR _currentmonth =
    MAX ( 'Month'[Index] )
VAR _dataonerunningtotal =
    CALCULATE (
        SUM ( 'Data one'[Value one] ),
        FILTER ( ALL ( 'Month' ), 'Month'[Index] <= _currentmonth )
    )
VAR _datatworunningtotal =
    CALCULATE (
        SUM ( 'Data two'[Value two] ),
        FILTER ( ALL ( 'Month' ), 'Month'[Index] <= _currentmonth )
    )
RETURN
    DIVIDE ( _dataonerunningtotal, _datatworunningtotal )

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

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

4 REPLIES 4
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.

I hope the below can provide some ideas on how to create a solution for your datamodel.

 

Jihwan_Kim_0-1677041381964.png

 

Jihwan_Kim_1-1677041598706.png

 

Expected result measure: =
VAR _dataonerunningtotal =
    CALCULATE (
        SUM ( 'Data one'[Value one] ),
        WINDOW (
            1,
            ABS,
            0,
            REL,
            ALL ( 'Month'[Month], 'Month'[Index] ),
            ORDERBY ( 'Month'[Index], ASC )
        )
    )
VAR _datatworunningtotal =
    CALCULATE (
        SUM ( 'Data two'[Value two] ),
        WINDOW (
            1,
            ABS,
            0,
            REL,
            ALL ( 'Month'[Month], 'Month'[Index] ),
            ORDERBY ( 'Month'[Index], ASC )
        )
    )
RETURN
    DIVIDE ( _dataonerunningtotal, _datatworunningtotal )

 


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

Click here to schedule a short Teams meeting to discuss your question.

Thanks Jihwan, sadly I don't have access to the version of power bi with window, index, rel,orderby. Is there a way to translate that? Thanks again

Hi,

In the sample pbix file, please try to write a measure something like below.

 

Expected result measure V2: =
VAR _currentmonth =
    MAX ( 'Month'[Index] )
VAR _dataonerunningtotal =
    CALCULATE (
        SUM ( 'Data one'[Value one] ),
        FILTER ( ALL ( 'Month' ), 'Month'[Index] <= _currentmonth )
    )
VAR _datatworunningtotal =
    CALCULATE (
        SUM ( 'Data two'[Value two] ),
        FILTER ( ALL ( 'Month' ), 'Month'[Index] <= _currentmonth )
    )
RETURN
    DIVIDE ( _dataonerunningtotal, _datatworunningtotal )

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

Click here to schedule a short Teams meeting to discuss your question.

Sorry for the late reply but this worked great and saved me so much time, thanks! 😊

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