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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Susan13
Frequent Visitor

Running total of % of Total

Hi,

I am trying to show the running total for % of total.  In the image below the red line is the actual % of total.  But I want to sum these together, like the yellow line but the values are incorrect.

Capture1.PNG

 

 

 

 

This is my current measure however I am not sure where it is wrong.  I have tried other solutions that have been provided but was unable to get them to work.

 

 

PL RunningTotal = 
MAXX (
    vwPBIPourLineData,
    SUMX (
        FILTER (
            SUMMARIZE (
                CALCULATETABLE (
                    vwPBIPourLineData,
                    ALLEXCEPT (
                        vwPBIPourLineData,
                        vwPBIPourLineData[WeekNumber]
                    ),
                    ALLSELECTED ( vwPBIPourLineData[WeekNumber] )
                ),
                vwPBIPourLineData[PartNumber],
                "AbsDiff", SUM ( vwPBIPourLineData[AbsoluteDiff] )
            ),
            [AbsDiff]
                >= SUMX (
                    FILTER (
                        CALCULATETABLE (
                            vwPBIPourLineData,
                            ALLEXCEPT (
                                vwPBIPourLineData,
                                vwPBIPourLineData[WeekNumber]
                            ),
                            ALLSELECTED ( vwPBIPourLineData[WeekNumber] )
                        ),
                        vwPBIPourLineData[PartNumber]
                            = EARLIER ( vwPBIPourLineData[PartNumber], 2 )
                    ),
                    vwPBIPourLineData[AbsoluteDiff]
                )
        ),
        [AbsDiff]
    )
)




 

 

   

 

4 REPLIES 4
Anonymous
Not applicable

 

// Say that you want to have a "RT"
// across products and you want to
// sort them by a measure. Call the
// measure [Base Measure].
// Instead of products, you could
// write a very similar measure
// that would give you a RT across
// product categories, for instance.

[Base Measure - Product RT] =
// Products should be on your x-axis
// and sorted according to [Base Measure]
// descending.
var __totalVisible =
	CALCULATE(
		[Base Measure],
		ALLSELECTED( Products )
	)
var __singleProductVisible =
	HASONEVALUE( Products[ProductId] )
var __currentProductValue = [Base Measure]
// Get the value of the base measure
// for all products before and including
// this one sorted by base measure
// descending.
var __totalForProductsUpToThisOne =
	SUMX(
		ALLSELECTED( Products ),
		var __iteratedProdValue = [Base Measure]
		var __shouldAdd =
			__iteratedProdValue >= __currentProductValue
		return
			__iteratedProdValue * __shouldAdd
	)
var __runningTotalPercentage =
	DIVIDE(
		__totalForProductsUptoThisOne,
		__totalVisible
	)
return
	if( __singleProductVisible, __runningTotalPercentage )

 

 

You have to think about how to deal with ties, that is, when 2 different products have the same [Base Measure].

 

Best

D

Thanks, I tried this method but still no luck.  Any other recommendations are welcome.

Anonymous
Not applicable

He there. It works for me:

 

https://1drv.ms/u/s!ApyQEauTSLtOgYMzWBdXOT0iIMwh6Q?e=MtblEU

 

Best

D

Anonymous
Not applicable

Technically, you're not doing a running total because a RT is performed against TIME. You are trying to aggregate across a different dimension. For this, you need to be able to sort the members of the dimension exactly as the visual sorts it and then aggregate accordingly.

Best
D

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.