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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
tjlundquist1
Helper I
Helper I

Running Total of % of Column Total

Need some help with a measure. I have created groups based on a date, and what I have been able to do is to see the % of values that fall in those groups. What I want to do is create a running total of those % of values. 

 

For example below, I want a column to display 44.42% for the 0-2 bucket and 65.40% for the 3-7 bucket and so on and so forth.

group1.jpg

I have created a measure, but it isn't accurate. It's not referencing the state or any of the other data in my query. The percentages are within a 10th or 100th of a percent - and that isn't possible. 

See below, Lines is the column that is accurate. Measure is the measure that I have created. The 0-2 bucket row should be the same for lines and measure and it isn't..

grou2.jpg

Here is the measure:

 

 

 

Measure = 
VAR _table =
    SUMMARIZE (
        Query1,
        Query1[Group Bucket],
        "a", CALCULATE ( MAX ( Query1[Index] ), ALLEXCEPT ( Query1, Query1[Group Bucket] ) )
    )
VAR _cumulative =
    CALCULATE ( MAX ( Query1[Index] ), _table )
VAR _total =
    CALCULATE ( MAX ( Query1[Index] ), ALL ( Query1 ) )
RETURN
    _cumulative / _total

 

 

 

Ultimately, I am going to create a graph that looks like the one in excel below - I be slicing by state and line of business.

2020-02-10_15-11-16.2.jpg

 

Any help would be really appreciated! I don't do running totals often, they are tricky.

Trevor

1 ACCEPTED SOLUTION
3 REPLIES 3

Thank you - I tried the cumulative measure. I have attached a sample pbix to show the result, and it's not what I am looking for.
The measure I created is called "Test Measure."

Test measure = 
var CountbyGroup=CALCULATE(COUNT('Sheet1 (2)'[Line #]),FILTER(ALLSELECTED('Sheet1 (2)'),ISONORAFTER('Sheet1 (2)'[Custom (groups)],MAX('Sheet1 (2)'[Custom (groups)]),DESC)))
var TotalCount=CALCULATE(COUNT('Sheet1 (2)'[Line #]),ALLSELECTED('Sheet1 (2)'))
return DIVIDE(CountbyGroup,TotalCount)

 

Link to pbix 

On page 2, the top chart should should start with the percentage of lines in the first group against the total number of lines. And each group following the previous group should show it's percentage plus the previous percentage. So you can see the bottom chart shows the number of lines in each group respectivly. 

0-2 should be something like 40% and 365 < should be 100%.

 

Thoughts? @amitchandak 

Greg_Deckler
Super User
Super User

Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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