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
Lucy64
Advocate II
Advocate II

Running Total Part 2

Last year I got help here on building the following formula:

 

RunningTotal = MAXX(vwScalesDataFabricationNetValue, SUMX(
FILTER(
SUMMARIZE(CALCULATETABLE(vwScalesDataFabricationNetValue, ALLEXCEPT(vwScalesDataFabricationNetValue, vwScalesDataFabricationNetValue[BuildingName]), ALLSELECTED(vwScalesDataFabricationNetValue[BuildingName])), vwScalesDataFabricationNetValue[MachineName], "NetVal", SUM(vwScalesDataFabricationNetValue[Fabrication Net Value])),
[NetVal] >=
SUMX(FILTER(CALCULATETABLE(vwScalesDataFabricationNetValue, ALLEXCEPT(vwScalesDataFabricationNetValue, vwScalesDataFabricationNetValue[BuildingName]), ALLSELECTED(vwScalesDataFabricationNetValue[BuildingName])), vwScalesDataFabricationNetValue[MachineName]= EARLIER(vwScalesDataFabricationNetValue[MachineName], 2)), vwScalesDataFabricationNetValue[Fabrication Net Value])), [NetVal]))

 

However changes have been made and I have run into to problem.  As you can see the formula which is used for the line in this chart is working well when I filter on Building Name.  

 

However on the 3rd diagram when I filter on week number the result of the calculated runnning total is not the same.

ImageA.PNGImageB.PNGImageC.PNG

 

Would appreciate your help to resolve this, if needed you can find the file here

1 ACCEPTED SOLUTION
v-sihou-msft
Microsoft Employee
Microsoft Employee

@Lucy64

 

In your scenario, your running total calculation is over all week numbers. When you select a week number in slicer, it just filter each fact data for your selected week number. If you want to show the correct running total pct, you also need to have your calculation group on "Week Number". Just add the "Week Number" column in ALLEXCEPT() function.

 

RunningTotal =
MAXX (
    vwScalesDataFabricationNetValue,
    SUMX (
        FILTER (
            SUMMARIZE (
                CALCULATETABLE (
                    vwScalesDataFabricationNetValue,
                    ALLEXCEPT (
                        vwScalesDataFabricationNetValue,
                        vwScalesDataFabricationNetValue[BuildingName],
                        vwScalesDataFabricationNetValue[WeekNumber]
                    ),
                    ALLSELECTED ( vwScalesDataFabricationNetValue[BuildingName] )
                ),
                vwScalesDataFabricationNetValue[MachineName],
                "NetVal", SUM ( vwScalesDataFabricationNetValue[Fabrication Net Value] )
            ),
            [NetVal]
                >= SUMX (
                    FILTER (
                        CALCULATETABLE (
                            vwScalesDataFabricationNetValue,
                            ALLEXCEPT (
                                vwScalesDataFabricationNetValue,
                                vwScalesDataFabricationNetValue[BuildingName],
                                vwScalesDataFabricationNetValue[WeekNumber]
                            ),
                            ALLSELECTED ( vwScalesDataFabricationNetValue[BuildingName] )
                        ),
                        vwScalesDataFabricationNetValue[MachineName]
                            = EARLIER ( vwScalesDataFabricationNetValue[MachineName], 2 )
                    ),
                    vwScalesDataFabricationNetValue[Fabrication Net Value]
                )
        ),
        [NetVal]
    )
)

 

99.PNG

 

Regards,

 

View solution in original post

3 REPLIES 3
v-sihou-msft
Microsoft Employee
Microsoft Employee

@Lucy64

 

In your scenario, your running total calculation is over all week numbers. When you select a week number in slicer, it just filter each fact data for your selected week number. If you want to show the correct running total pct, you also need to have your calculation group on "Week Number". Just add the "Week Number" column in ALLEXCEPT() function.

 

RunningTotal =
MAXX (
    vwScalesDataFabricationNetValue,
    SUMX (
        FILTER (
            SUMMARIZE (
                CALCULATETABLE (
                    vwScalesDataFabricationNetValue,
                    ALLEXCEPT (
                        vwScalesDataFabricationNetValue,
                        vwScalesDataFabricationNetValue[BuildingName],
                        vwScalesDataFabricationNetValue[WeekNumber]
                    ),
                    ALLSELECTED ( vwScalesDataFabricationNetValue[BuildingName] )
                ),
                vwScalesDataFabricationNetValue[MachineName],
                "NetVal", SUM ( vwScalesDataFabricationNetValue[Fabrication Net Value] )
            ),
            [NetVal]
                >= SUMX (
                    FILTER (
                        CALCULATETABLE (
                            vwScalesDataFabricationNetValue,
                            ALLEXCEPT (
                                vwScalesDataFabricationNetValue,
                                vwScalesDataFabricationNetValue[BuildingName],
                                vwScalesDataFabricationNetValue[WeekNumber]
                            ),
                            ALLSELECTED ( vwScalesDataFabricationNetValue[BuildingName] )
                        ),
                        vwScalesDataFabricationNetValue[MachineName]
                            = EARLIER ( vwScalesDataFabricationNetValue[MachineName], 2 )
                    ),
                    vwScalesDataFabricationNetValue[Fabrication Net Value]
                )
        ),
        [NetVal]
    )
)

 

99.PNG

 

Regards,

 

One more question, I hope you can help.  This works when only one building is selected however it does not if I select more than 1 building on the hierarchy slicer.  

 

The Hierarchy is:  

BuildingName

ProductionLineName

MachineName

 

The Machine Name is used on the graph.

 

Any suggestions? 

Thanks Simon, that did the trick!

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.