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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Aggie_Cls__93
Frequent Visitor

Running totals of Average by Category

Hi,

 

I have a line graph that displays the following:

 

X-Axis(Axis) = 'Daily_Prod'.[Days On Production]

Y-Axis(Vallue) =  'Daily_Prod'[Oil]

Legend = 'Well_Header'[Well_Group]

 

This graph works great but I need to make a running total graph of the plotted values.  Specifically, I need a line graph that first averages the data based the Legend [Well_Group] and the X-Axis [Days_On_Prod].  Then, I need to plot a running total of this averaged value.  Any help would be greatly appreciated.  Thanks in advance.

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @Aggie_Cls__93 

 

In your case, EARLIER function is my suggestion to create a calculate column or a measure, and then use it to create the line graph:

If I understand your question correctly, the following formula should work: 

 

Running Average by Category =
CALCULATE (
    AVERAGE ( Daily_Prod[Oil] ),
    FILTER (
        Daily_Prod,
        Daily_Prod[Days On Production] <= EARLIER ( Daily_Prod[Days On Production] )),
    	Daily_Prod[Well_Group] = EARLIER ( Daily_Prod[Well_Group] )
)

 

Best, Regards,

Paul Zheng

 

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

3 REPLIES 3
Anonymous
Not applicable

Hi, @Aggie_Cls__93 

 

In your case, EARLIER function is my suggestion to create a calculate column or a measure, and then use it to create the line graph:

If I understand your question correctly, the following formula should work: 

 

Running Average by Category =
CALCULATE (
    AVERAGE ( Daily_Prod[Oil] ),
    FILTER (
        Daily_Prod,
        Daily_Prod[Days On Production] <= EARLIER ( Daily_Prod[Days On Production] )),
    	Daily_Prod[Well_Group] = EARLIER ( Daily_Prod[Well_Group] )
)

 

Best, Regards,

Paul Zheng

 

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

danextian
Super User
Super User

Assuming that Days on Production is where you want to be base the running total on, you can have a measure like this:

Running Total =
CALCULATE (
    [Aggregation Measure],
    FILTER (
        ALLSELECTED ( Daily_Prod ),
        Daily_Prod[Days On Production] <= MAX ( Daily_Prod[Days On Production] )
    )
)

 Just a tip:

Please post a sample data that can be copy pasted and your expected results. You'll get  faster and better responses.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Thanks Dan.  Good feedback on being more specific.  I'm going to do a better job and repost.

 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.