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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Need count total of a column to calculate %

Hello, I have a matrix with a column of counts by ship via type. I would like to calculate each row's percent of the total, i.e. 

10 PDC ISSUE % is 2 / 1307 = 0.15%

 

I can't seem to come up with a calulation which will give me the grand total count at each row level to use as the denominator. Every search I've done on this comes up with ways if the values are sums but they don't work if the values are counts. Is there a way?

 

 

SHIP_VIACountPercent
01 PDC ISSUE2100.00%
10 UPS BLUE LABEL8100.00%
21 FEDX 1D AIR2100.00%
25 FEDX 2D ECON4100.00%
26 DO NOT SHIP11100.00%
2G UPS GRD TRAC107100.00%
36 UPS 1D AIR7100.00%
42 FEDX 1D PRIOR COL16100.00%
4U UPS 1D 0800 COL1100.00%
4X UPS 1D SAVER COL3100.00%
52 FEDX 2D COL10100.00%
5B UPS 3D SELECT COL10100.00%
5W FEDX SAVER COL9100.00%
6F FEDX EXP SAVER1100.00%
6K FDX FRT PR COL3100.00%
BS SAIA MOTORS PPD1100.00%
BW FDX LTL FRT ECO2100.00%
D5 FDX FRT ECO COL1100.00%
DE UPS STD GRD COL18100.00%
F8 FEDX GRD BILL REC358100.00%
H8 FEDX STD 1D3100.00%
JM FEDX GRD PPD118100.00%
L3 FEDX STD OVNT COL.22100.00%
M2 UPS GRD COL524100.00%
M3 UPS 1D AIR COL31100.00%
M4 UPS 2D COL33100.00%
Q7 UPS 3DAY SELECT2100.00%
 1307 
1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Assuming count is a measure, write this additional measure

=[Count]/CALCULATE([Count],ALL(Data[SHIP_VIA]))

Format this measure as %.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

6 REPLIES 6
Greg_Deckler
Super User
Super User

Can you add Count again to your Values and then just right click, Show As, Percent of Grand Total?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Ashish_Mathur
Super User
Super User

Hi,

Assuming count is a measure, write this additional measure

=[Count]/CALCULATE([Count],ALL(Data[SHIP_VIA]))

Format this measure as %.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Thank you Ashish, this worked and it finally helped me understand the ALL function.

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
ChrisMendoza
Resident Rockstar
Resident Rockstar

@Anonymous -

Is this what you need?

Measure =
SUM ( TableName[Count] )
    / CALCULATE (
        SUM ( TableName[Count] ),
        ALL ( TableName[SHIP_VIA] )
    )

 

 





Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



Anonymous
Not applicable

Chris, your suggestion did not work for me. I'm counting string Ship Via codes and your formula came back saying it could not sum text values.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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