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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
0Experience
Helper I
Helper I

How to show count (percentage) on Pie Chart that related to a Bar Chart

Hello,

I'm presenting data through a combination of a bar chart and two pie charts.

 

Pie Chart 1:

                   i) When all years of the bar chart are selected, it displays the percentage of each category. 

                   ii) When only one year is selected from the bar chart, it reveals the percentage of each category for that specific year. For instance, if 2023 is selected, it shows B 42.97% (42.97%).

 

Pie Chart 2:

                   i) Similarly, when all years of the bar chart are selected, it exhibits the percentage of each category.

                   ii) However, when only one year is chosen from the bar chart, it contrasts the percentage of each category for that year against the overall percentages across all years. For instance, if 2023 is selected, it might show B 55 (18.58%).

 

0Experience_0-1714662689867.png

 

 

Expected Output from Chart 1: When selecting a single year, such as 2023, I anticipate seeing the count of each category along with its corresponding percentage, like B 55 (42.97%).

 

You can get the power bi file from the give link (Google Drive).

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @0Experience ,

 

Add the following measure:

Values Measure = 

IF(ISFILTERED('Table'[Year]), CALCULATE(SUM('Table'[Count]) , 'Table'[Year] = MAX('Table'[Year])), SUM('Table'[Count]))

MFelix_0-1714665110183.png

 

MFelix_1-1714665122952.png

 

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

3 REPLIES 3
MFelix
Super User
Super User

Hi @0Experience ,

 

Add the following measure:

Values Measure = 

IF(ISFILTERED('Table'[Year]), CALCULATE(SUM('Table'[Count]) , 'Table'[Year] = MAX('Table'[Year])), SUM('Table'[Count]))

MFelix_0-1714665110183.png

 

MFelix_1-1714665122952.png

 

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Thanks @MFelix 

 

Your attached file is woriking expectedly. However, if I write the code on my file and make a new chart, it is not working the expected way. It works like the chart 2.

 

Did you make any other seetings?

 

0Experience_0-1714665896810.png

 

What I understand, you highlighted the filter option from the "interaction" settings from the "Format" option. 

If we do this, then we do not need to write the measure you gave.

 

However, I am accepting your answer as I got the idea from your reply.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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