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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Anonymous
Not applicable

How to add a percentage of data covered to a chart

I think this would be a relatively simple process but am unable to figure it out. I have a donut chart that shows the sum of data from the table below (sample).

 

IDOfficeSalesSales Type
1NYC10,000Online
2LA25,000Store
3LA10,000Online
4NYC5,000Store

 

My donut chart shows the make up of total sales from Sales Type, and is filtered on the NYC office only.

 

I want to add a card visual that shows that in this filtered bar chart, 30% of sales is explained. (NYC has 30% of total sales). When I add the sales variable to the card visual and then change it to 

I am trying to add a card type visual that shows that out of all sales, NYC contains 40% of total sales. Currently I am adding a card that shows sum of sales as a percentage of grand total. However, it always just shows 100%.

1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @Anonymous ,

You can create a measure as below to get the percentage, please find the details in the attachment.

Percentage = 
VAR _persales =
    SUM ( 'Table'[Sales] )
VAR _allsales =
    CALCULATE ( SUM ( 'Table'[Sales] ), ALL ( 'Table' ) )
RETURN
    DIVIDE ( _persales, _allsales )

yingyinr_0-1671606821219.png

If the above one can't help you get the desired result, please provide more raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

And it is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community.

How to upload PBI in Community

Best Regards

Community Support Team _ Rena
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-yiruan-msft
Community Support
Community Support

Hi @Anonymous ,

You can create a measure as below to get the percentage, please find the details in the attachment.

Percentage = 
VAR _persales =
    SUM ( 'Table'[Sales] )
VAR _allsales =
    CALCULATE ( SUM ( 'Table'[Sales] ), ALL ( 'Table' ) )
RETURN
    DIVIDE ( _persales, _allsales )

yingyinr_0-1671606821219.png

If the above one can't help you get the desired result, please provide more raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

And it is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community.

How to upload PBI in Community

Best Regards

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

Hi @Anonymous,

 

Create a sales measure that ignores the filter context.

 

Total Sales = CALCULATE(SUM('Table'[Sales]),FILTER(ALL('Table'),'Table'[Sales]))

 

Screenshot 2022-12-20 212103.jpg

 

Then for percentage, you create formula that takes [_Sales]/[Total Sales]

 

Works for you? Mark this post as a solution if it does!
Check out this blog of mine: How to Export Telemetry Data from Azure IoT Central into Power BI

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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