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

Create a % Running Total (0-100% complete) Measure from a Group Field

Hello. 

 

I am trying to create a visual that will show the % of storm claims reported by # of days from loss to reported. So for example from 0-2 days, 41% of all losses have been reported and all the way to 211-240 days would be 96% of all losses have been reported. 

 

I created this in excel by doing a count of my formula to find the difference between date reported and date of loss, and displayed that result as a "% running total In." Now i'm trying to recreate this in Power BI.2020-02-10_15-07-55.jpg "

 

 

 

 

 

 

 

 

 

As you can see above, I've grouped the measure into buckets. However, I want this to display as I explained above - being as the buckets get larger, the % gets closer and closer to 100% of the total. It should be 0-2 is 42 ish% and >365 is 100%. 

 

Below is what the graph looks like in excel. 

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

Looking for some assistance on a measure that will work with my group fields as the replacement for a column and recreating this chart from excel to Power BI. 

Thank you!

 

Trevor

 

1 ACCEPTED SOLUTION

Hi @tjlundquist1 ,

 

You could try the following measure:

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

Here is my test result.

1-1.PNG

Here is the sample data. You need to replace data source with yours.

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

6 REPLIES 6
v-eachen-msft
Community Support
Community Support

Hi @tjlundquist1 ,

 

I think you need to accumulate your measure.

At first, you need to add an index column in the query editor. Then refer to the following measure:

Measure 2 =
SUMX (
    FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Index] <= MAX ( 'Table'[Index] ) ),
    [Measure]
)

Here is my test result:

3-1.PNG

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

 

That's a great measure. I'm just not getting it to work for me - what did you use for "measure?" Is that a % to grand total measure? I think that's where my problem is in the sumx measure is the expression for that measure.

For [# of lines] - it's just a dinstinct count of line #'s, which lay out like this format "A######P##.

 

1.1.jpg

1.3.jpg

 

Thanks for your help @v-eachen-msft 

 

Hi @tjlundquist1 ,

 

Could you please share your sample data and excepted result to me if you don't have any confidential information. Please upload your files to OneDrive and share the link here.

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

Here is a link to the sample data/ pbix. Expected results in the PBIX.

https://1drv.ms/u/s!Am_I6JawN6C-azxr1Y2C_BhJ-UM?e=C1hx3D 

 

Thanks for your help @v-eachen-msft 

Hi @tjlundquist1 ,

 

You could try the following measure:

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

Here is my test result.

1-1.PNG

Here is the sample data. You need to replace data source with yours.

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

@v-eachen-msft - I really appreciate your help with this.

At first, it didn't work - and I didn't understand. I got the same result as I got when I ran your previous SUMX measure, and the only thing that was the same was the INDEX column.

I deleted the INDEX colum and went to the query editor, highlighted the # of days column, created a new INDEX - and I'll be darned it worked!

 

You're awesome, thanks for working with me!

 

Trevor

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.