cancel
Showing results 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.

Frequent Visitor

## Stacked bar chart - % of GT Calculation when using Slicer

Hi,

I have data from a survey for 1000+ respondents asking what customers are using today vs tomorrow split across 4 dimensions.

The percentage is calculated as a ratio of that category to the overall count.

But when I use the Filters Pane to only show one of the categories, the percentage is recalculated on the new base as per the Filters. Is there a way it is calculated on the grand total and not the sliced value for that. Is there any workaround to avoid this?

Here's the sample graph - overall (first image) and the Filtered for USE NOW category only (second image):

Is there a way I can calculate the the percentage for individual category (e.g. USE NOW in this example) (when filtering on visual for that category) over the grand total instead of the total rows after filtering.

Here's what the table structure looks like.

Cheers,

Nikhil

1 ACCEPTED SOLUTION
Community Support

Hi @batranikhil ,

Create a measure as below:

``````Measure =
var _count1=CALCULATE(COUNT('Table'[Value]),FILTER(ALL('Table'),'Table'[Value]=MAX('Table'[Value])&&'Table'[Attribute]=MAX('Table'[Attribute])))
var _count2=CALCULATE(COUNT('Table'[Attribute]),FILTER(ALL('Table'),'Table'[Attribute]=MAX('Table'[Attribute])))
Return
DIVIDE(_count1,_count2)``````

And you will see:

For the related .pbix file,pls see attached.

Best Regards,
Kelly

2 REPLIES 2
Community Support

Hi @batranikhil ,

Create a measure as below:

``````Measure =
var _count1=CALCULATE(COUNT('Table'[Value]),FILTER(ALL('Table'),'Table'[Value]=MAX('Table'[Value])&&'Table'[Attribute]=MAX('Table'[Attribute])))
var _count2=CALCULATE(COUNT('Table'[Attribute]),FILTER(ALL('Table'),'Table'[Attribute]=MAX('Table'[Attribute])))
Return
DIVIDE(_count1,_count2)``````

And you will see:

For the related .pbix file,pls see attached.

Best Regards,
Kelly

Frequent Visitor

Thanks Kelly. Will try this. Thanks!

Announcements

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

#### Power BI Monthly Update - April 2024

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

#### Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors