cancel
Showing results for
Did you mean:
Highlighted
Helper III

## Stacked bar chart - % of total

This might be a simple fix, im not sure.

I have a simple table (shown below). Essentially what i want is a stacked bar chart show progress to the total.

Name                     10                                       5

When i create the bar chart, the %'s are using a total of 15 instead of 10. So it would show 30% instead of 50%, when comparing completed tasks to total.

Any advice? (P.S. I know this can be achieved in a bullet chart but IMO this is more visually appealing for me audience.)

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support

## Re: Stacked bar chart - % of total

Workaround:

I make a copy of "Sheet6" as "Sheet7", in "Sheet7", select "Tasks Needed" and "Tasks Completed" columns, then "Unpivot columns",

Close &&Apply, create a measure in "Sheet7",

Measure =
VAR percentage =
CALCULATE (
SUM ( Sheet7[Value] ),
FILTER (
ALL ( Sheet7 ),
Sheet7[Label ] = MAX ( Sheet7[Label ] )
)
)
/ CALCULATE (
SUM ( Sheet7[Value] ),
FILTER (
ALL ( Sheet7 ),
Sheet7[Label ] = MAX ( Sheet7[Label ] )
)
)
RETURN
IF ( MAX ( Sheet7[Attribute] ) = "Tasks Completed", percentage, 1 - percentage )

Select data format for this measure as "percentage",

Add columns and measures from Sheet7 in the "Stacked bar chart" as below

Best Regards

Maggie

5 REPLIES 5
Highlighted
Super User IX

## Re: Stacked bar chart - % of total

Given the information provided, I'm not following why you are getting a 15 instead of 10. You can display a % of total by clicking the little drop down next to the column or measure in the fields area under VISUALIZATIONS and choose Show Value As | Percentage of Grand Total

---------------------------------------

##### I have a NEW book! DAX Cookbook from Packt
Over 120 DAX Recipes!

Proud to be a Super User!

Highlighted
Helper III

## Re: Stacked bar chart - % of total

Here is a better example. I am using the 100% stacked column chart (sorry i misspoke in title).

I have two values: one value is the "needed" at 784, one value is the "completed" at 64.

The data label inside the "completed" is 7.55% which is wrong. It is using (784+64) as the total instead of using 64/784 = 8.2%.

Highlighted
Super User V

## Re: Stacked bar chart - % of total

Hi,

Try this measure

Hope this helps.

Regards,
Ashish Mathur
http://www.ashishmathur.com
Highlighted
Community Support

## Re: Stacked bar chart - % of total

Workaround:

I make a copy of "Sheet6" as "Sheet7", in "Sheet7", select "Tasks Needed" and "Tasks Completed" columns, then "Unpivot columns",

Close &&Apply, create a measure in "Sheet7",

Measure =
VAR percentage =
CALCULATE (
SUM ( Sheet7[Value] ),
FILTER (
ALL ( Sheet7 ),
Sheet7[Label ] = MAX ( Sheet7[Label ] )
)
)
/ CALCULATE (
SUM ( Sheet7[Value] ),
FILTER (
ALL ( Sheet7 ),
Sheet7[Label ] = MAX ( Sheet7[Label ] )
)
)
RETURN
IF ( MAX ( Sheet7[Attribute] ) = "Tasks Completed", percentage, 1 - percentage )

Select data format for this measure as "percentage",

Add columns and measures from Sheet7 in the "Stacked bar chart" as below

Best Regards

Maggie

Highlighted
Helper III

## Re: Stacked bar chart - % of total

This is awesome! Thanks

Announcements

#### Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

#### Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.

#### Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021