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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
ekroll
Frequent Visitor

Percent of Total Counts

I'm having some trouble understanding how to get the percent of a total count for category.

I have a measure that counts the rows for a given criteria (where the days late are >=1).

What I need to do is provide the percent Total_Carrier_Lates per carrier compared to the total of all Total_Carrier_Lates:

ekroll_0-1663866673080.png

So in the table above, I'm look to add a new column that says late weighting... row 1 would be 6614/12621...

How do I get the sum of the total counts?

Every example I've seen uses SUM to add some thing like a sales amount column, but I need to count the instances that match the critera and then add those up?

My measure counting the late shipments is:

Total_Carrier_Lates = CALCULATE(
    COUNTROWS('EAP LTL Shipments'),
    'EAP LTL Shipments'[DaysLate]>=1,
    'EAP LTL Shipments'[Carrier_Responsible]=TRUE
    )

Appreciate any help.

1 ACCEPTED SOLUTION
ekroll
Frequent Visitor

Probably should have known it would click after posting....

SumLates =
var total_late = CALCULATE(
    COUNTROWS('EAP LTL Shipments'),
    'EAP LTL Shipments'[DaysLate]>=1,
    'EAP LTL Shipments'[Carrier_Responsible]=TRUE,
    ALL('EAP LTL Shipments')
    )
return
 DIVIDE([Carrier_Lates],total_late)
 
Seems to give me what I'm looking for.
ekroll_0-1663867800582.png

 

View solution in original post

2 REPLIES 2
tamerj1
Super User
Super User

Hi @ekroll 

please try

% Late =
DIVIDE (
    [Total_Carrier_Lates],
    CALCULATE ( [Total_Carrier_Lates], ALL ( 'EAP LTL Shipments'[Category] ) )
)
ekroll
Frequent Visitor

Probably should have known it would click after posting....

SumLates =
var total_late = CALCULATE(
    COUNTROWS('EAP LTL Shipments'),
    'EAP LTL Shipments'[DaysLate]>=1,
    'EAP LTL Shipments'[Carrier_Responsible]=TRUE,
    ALL('EAP LTL Shipments')
    )
return
 DIVIDE([Carrier_Lates],total_late)
 
Seems to give me what I'm looking for.
ekroll_0-1663867800582.png

 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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

Top Solution Authors