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
vidyasagar159
Helper II
Helper II

Count of Records upon slicing the data divided by Total Record counts

Hi,

 

I am a new bee. I have a small requirement. I want find the Active percentage of Employees of each manager. From the below sample data.

 

Lets say, From the slicer if I select a Manager called Brayn then I want to know the active percentage of his employees. Some one please help me with the expression.

 

ManagerEmployeeStatus
BraynRikiAcctive
BraynJohnPassive
BraynJessiActive
ChrisStuartActive
ChrisRobinPassive
ChrissamPassive
ChrispeterPassive
1 ACCEPTED SOLUTION
Phil_Seamark
Employee
Employee

HI @vidyasagar159

 

Please add the following two calculated measures

 

Total Active Employees per Manager = 
    CALCULATE(
        COUNTROWS('Table1'),
        FILTER(
            ALL('Table1'),
            [Manager] = MAX('Table1'[Manager]) && 
            [Status] = "Active"
            )
           )
Total Employees per Manager = 
    CALCULATE(
        COUNTROWS('Table1'),
        FILTER(
            ALL('Table1'),
            [Manager] = MAX('Table1'[Manager])
            )
           )

finally

 

Ratio = DIVIDE([Total Active Employees per Manager],[Total Employees per Manager],0)

 

 


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

4 REPLIES 4
vidyasagar159
Helper II
Helper II

I guess, I found the solution.  For the Manager "Brayn"

 

Step1: Active Employees Measure =   COUNTROWS(FILTER(Master,Master[Employee]="Active"))

Result = 2

 

Step2: Total Employee Measure = COUNTA(Master[Employee])

Result = 3 

 

Step3:  Active Employees Measure /  Total Employee Measure (2/3) = 66%

 

There  might be a simple method. But  this  solved my  issue as of  now

 

Thanks,

-Vidya

 

 

Phil_Seamark
Employee
Employee

HI @vidyasagar159

 

Please add the following two calculated measures

 

Total Active Employees per Manager = 
    CALCULATE(
        COUNTROWS('Table1'),
        FILTER(
            ALL('Table1'),
            [Manager] = MAX('Table1'[Manager]) && 
            [Status] = "Active"
            )
           )
Total Employees per Manager = 
    CALCULATE(
        COUNTROWS('Table1'),
        FILTER(
            ALL('Table1'),
            [Manager] = MAX('Table1'[Manager])
            )
           )

finally

 

Ratio = DIVIDE([Total Active Employees per Manager],[Total Employees per Manager],0)

 

 


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Hi @Phil_Seamark,

 

Mine is only working in Cards. when I am applying the same inside a table total count is filtering out and i am always getting 100%. But your code is perfectly working in a table. 

 

I really appreciate your help. Smiley Wink

 

Thanks,

-Vidya

Hi,

 

Thanks for looking into this issue. So is there any difference between our logic? 

 

Thanks,

-Vidya

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.

Top Solution Authors