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
elle-queue
Frequent Visitor

Percentage by category based on category status

Hi all - I'm trying to get a percentage of overdue registrations per category.  A data sample is below.  The registrations should be counted, not summed.

 

CategoryStatusRegistration
AppleNot Due4600
OrangeNot Due4218
PearOverdue4696
StrawberryOverdue4215
OrangeOverdue4050
PearNot Due4491
AppleOverdue3291
StrawberryNot Due2026
StrawberryNot Due2365
AppleNot Due2943
StrawberryOverdue2247
PearNot Due4143
OrangeOverdue2353
OrangeNot Due2010
PearNot Due3502

 

If I manually perform the calcuation in Excel, it looks like this:

 

 Status  
CategoryNot DueOverdueTOTAL% Overdue
Apple21333%
Orange22450%
Pear31425%
Strawberry22450%

 

The answer I'm looking for is highlighted red above.  I tried, couldn't figure it out LOL.  Any help is appreciated, many thanks.

 

 

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @elle-queue ,

 

plot a measure like:

 

%Overdue = 
VAR _overdue =
    COUNTROWS(    
        FILTER(
            data,     
            data[status]="Overdue"
        )
    )
VAR _total = COUNTROWS(data)
RETURN DIVIDE(_overdue, _total)

 

 

it worked like:

FreemanZ_0-1730351266413.png

 

 

View solution in original post

8 REPLIES 8
Kedar_Pande
Resident Rockstar
Resident Rockstar

@elle-queue 

CountOverdue = 
CALCULATE(
COUNT('YourTable'[Registration]),
'YourTable'[Status] = "Overdue"
)
TotalRegistrations = 
CALCULATE(
COUNT('YourTable'[Registration])
)
PercentageOverdue = 
DIVIDE([CountOverdue], [TotalRegistrations], 0) * 100

💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn

thank you so much @Kedar_Pande 

FreemanZ
Super User
Super User

hi @elle-queue ,

 

plot a measure like:

 

%Overdue = 
VAR _overdue =
    COUNTROWS(    
        FILTER(
            data,     
            data[status]="Overdue"
        )
    )
VAR _total = COUNTROWS(data)
RETURN DIVIDE(_overdue, _total)

 

 

it worked like:

FreemanZ_0-1730351266413.png

 

 

Thanks you @FreemanZ 

@FreemanZ  The file you shared is not downloading, can you reshare it? Thanks!

hi @HamedM1125 ,

 

thanks for the feedback. could you try it again?

HamedM1125
Advocate III
Advocate III

@elle-queue 

You can try the following measure:

Total Percentage = DIVIDE(
                            COUNT('Table'[Status]),
                            CALCULATE(
                                    COUNT('Table'[Status]),
                                    ALLEXCEPT('Table','Table'[Category])),
                                    0)
HamedM1125_0-1730350837591.png

Let me know if that works. Kudos!



Thank you @HamedM1125 .  This isn't exactly what I was wanting, but I can see how it could be useful for something else i'm working on, so thank you!  

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.