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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Kira_Net
Helper I
Helper I

How to calculate the percent of contribution to the total (Percent to total)

Hi there,
I wanted to create a matrix visualization which has a client field on the Row, Ship A, Ship B, Ship C and Ship D on the Values. My problem is my table looks as follows. I need to create a percent to total for all shipping methods to put them as individual fields on the values section. Can somebody help me please?

 

Client Shipping MethodPacked Date
ABCShip A03/22/2021
XYZShip D04/22/2021
ABCShip A03/27/2021
XYZShip C07/12/2021
XYZShip B05/23/2021
ABCShip C01/19/2022
1 ACCEPTED SOLUTION

Hi @Kira_Net 

"But I need how many percent of product XYZ shipped by Ship A, Ship B, Ship C and Ship D" 

in this scenario, you can try this 

Percentage = 
var _countPermethod= CALCULATE(COUNTROWS('Table'),FILTER(ALL('Table'), 'Table'[Client]=MIN('Table'[Client]) && 'Table'[Shipping Method]=MIN('Table'[Shipping Method])))
var _countTotalmethod= CALCULATE(COUNTROWS('Table'),FILTER(ALL('Table'),'Table'[Client]=MIN('Table'[Client])))
return 
DIVIDE (
    _countPermethod,
    _countTotalmethod
)

vxiaotang_0-1652258213327.png

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Kira_Net , A measure like

 

divide(count(Table[Shipping Method]) , calculate(count(Table[Shipping Method]) , allselected()) )

 

or

 

divide(count(Table[Shipping Method]) , calculate(count(Table[Shipping Method]) , all()) )

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 Thank you. But this only gives me the percent to total for all shipping method. But I need how many percent of product XYZ shipped by Ship A, Ship B, Ship C and Ship D?

 

Hi @Kira_Net 

"But I need how many percent of product XYZ shipped by Ship A, Ship B, Ship C and Ship D" 

in this scenario, you can try this 

Percentage = 
var _countPermethod= CALCULATE(COUNTROWS('Table'),FILTER(ALL('Table'), 'Table'[Client]=MIN('Table'[Client]) && 'Table'[Shipping Method]=MIN('Table'[Shipping Method])))
var _countTotalmethod= CALCULATE(COUNTROWS('Table'),FILTER(ALL('Table'),'Table'[Client]=MIN('Table'[Client])))
return 
DIVIDE (
    _countPermethod,
    _countTotalmethod
)

vxiaotang_0-1652258213327.png

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.