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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
pAAmckelvey
Frequent Visitor

Calculating Percentages for line items with data selected by slicer

I'm hoping the community can help me out here.  Searchese have proved fruitless so far.

 

The business has requested that we show total hours by project and also show the percentage of hours each project represents compared to the whole.  However, when a slicer is applied, the total number of hours used for the denominator doesn't seem to change.  Here is an example.

 

 

 

 

BF Table.jpg

 

Here is the data structure.   

Data Table.jpg

 

 

 What we are trying to figure out is how to get the denominator in this equation to be dynamic as slicers are applied so that the data that shows on the screen in the first screenshot displays the correct percentage.

 

 Any assistance that can be provided is greatly appreciated!

 

Patrick

 

 

1 ACCEPTED SOLUTION
v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @pAAmckelvey,

Based on my test, you can refer to below steps:

1.I have entered some sample data to test for your problem in below picture.

1.PNG

2.Create a new measure to calculate the percentage.

percentage = DIVIDE(SUM(Sheet2[Hours]),CALCULATE(SUM(Sheet2[Hours]),ALLSELECTED(Sheet2[Work Description])))

2.PNG

3.Create a Table visual and add the [Work Description] and the [Hours] field. Create a Slicer visual to add the [percentage] field. And now you can see the result.

3.PNG

4.PNG

You can also download the PBIX file to have a view.

 https://www.dropbox.com/s/7y8x1qrqy3h03qm/Calculating%20Percentages%20for%20line%20items%20with%20da...

 

Regards,

Daniel He

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

View solution in original post

2 REPLIES 2
v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @pAAmckelvey,

Based on my test, you can refer to below steps:

1.I have entered some sample data to test for your problem in below picture.

1.PNG

2.Create a new measure to calculate the percentage.

percentage = DIVIDE(SUM(Sheet2[Hours]),CALCULATE(SUM(Sheet2[Hours]),ALLSELECTED(Sheet2[Work Description])))

2.PNG

3.Create a Table visual and add the [Work Description] and the [Hours] field. Create a Slicer visual to add the [percentage] field. And now you can see the result.

3.PNG

4.PNG

You can also download the PBIX file to have a view.

 https://www.dropbox.com/s/7y8x1qrqy3h03qm/Calculating%20Percentages%20for%20line%20items%20with%20da...

 

Regards,

Daniel He

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

Thank you so much @v-danhe-msft!  This worked like a charm!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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