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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
SantoshKumar
Microsoft Employee
Microsoft Employee

Dynamic Percentage Calculation on Stacked Column Chart based on Mouse hover on the columns data

Hi Team,

 

Requirement:

 

When I hovertip on the chart, the percentage should be calculated as the selected category divided by the total across all categories for that month. So as per below snapshot, when i hover my mouse_pointer on "531", the percentage should be 531/(531+50+50+95)=73%, and secondly if i hover on below "50" value on the same photo should show 50/(531+50+50+95)=7%. I have similar requirement on the same page for few more charts as well.

 

Note: i was able to create measure for percentage but the problem is that i have to create multiple measures to show percentages for each of them because the values for the chart are different measures/columns from different tables & instead i would like to have a single percentage measure.

 

 

 

SantoshKumar_1-1612242132579.png

SantoshKumar_2-1612242308073.png

 

 

Regards

Santosh Kumar P

 

1 ACCEPTED SOLUTION

Hi @SantoshKumar ,

 

If you,you'd better first unpivot all the category columns;

Then create a measure as below:

precision2 = 
var _total=CALCULATE(SUM('fact table (2)'[Value]),FILTER(ALL('fact table (2)'),'fact table (2)'[Month]=MAX('fact table (2)'[Month])))
Return
DIVIDE(MAX('fact table (2)'[Value]),_total)

And you will see:

v-kelly-msft_0-1612747888500.png

 

For the related .pbix file,pls see attached.

 


Best Regards,
Kelly

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

 

 

View solution in original post

6 REPLIES 6
v-kelly-msft
Community Support
Community Support

Hi @SantoshKumar ,

 

You could create a tooltip page and use "multi-row card"visual to realize it:

First create a measure as below:

precision = 
var _total=CALCULATE(SUM('Table'[value]),FILTER(ALL('Table'),'Table'[Date]=MAX('Table'[Date])))
Return
DIVIDE(MAX('Table'[value]),_total)

Finally you would see:

v-kelly-msft_0-1612491885339.png

 

Below is a reference about how to create tooltip page:

https://docs.microsoft.com/en-us/power-bi/create-reports/desktop-tooltips

 

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

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

Hi @v-kelly-msft ,

My requirement is almost similiar to it. Only change is that instead of One Column , i have more than two as below. I was unable to attach my sample file. could you please let me know what should i need to write in the measure with below mentioned data.

 

SantoshKumar_0-1612525996046.png

 

Stacked Chart Visual:

SantoshKumar_0-1612526621199.png

 

Thanks

Santosh

Hi @SantoshKumar ,

 

If you,you'd better first unpivot all the category columns;

Then create a measure as below:

precision2 = 
var _total=CALCULATE(SUM('fact table (2)'[Value]),FILTER(ALL('fact table (2)'),'fact table (2)'[Month]=MAX('fact table (2)'[Month])))
Return
DIVIDE(MAX('fact table (2)'[Value]),_total)

And you will see:

v-kelly-msft_0-1612747888500.png

 

For the related .pbix file,pls see attached.

 


Best Regards,
Kelly

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

 

 

amitchandak
Super User
Super User

@SantoshKumar , Try a new measure like, assume your current measure is measure 

 

divide([measure], calculate([measure], allexcept(Table, Table[date])))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak Thanks for your response but its not working.  let me just reiterate my requirement here.

 

When I hovertip on the chart, the percentage should be calculated as the selected category divided by the total across all categories for that month. So as per below snapshot, when i hover my mouse_pointer on "531", the percentage should be 531/(531+50+50+95)=73%, and secondly if i hover on below "50" value on the same photo should show 50/(531+50+50+95)=7%.

 

Regards

Santosh 

@SantoshKumar , I tried this on my data , seems to be working

 

Measure 6 = DIVIDE([Sales], CALCULATE([Sales], REMOVEFILTERS('Item'[Category])))
 
Screenshot 2021-02-03 13.40.42.png
 
 
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors