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
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
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