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
shiv1002
Regular Visitor

Calculate percentage based on selection and column value

I need to show the percentage of employees certified as well as not certified based on office selected from a drop-down office selection. I need to show a separate row for each selected office. Below is the sample of data and desired output:

Data.jpg   

Result.jpg

Thanks in advance

1 ACCEPTED SOLUTION
SivaMani
Resident Rockstar
Resident Rockstar

@shiv1002,

 

Create two calculated measure using DAX,

 

Certified = DIVIDE(COUNTX(FILTER(Table1,Table1[Certified ] = "Y"),Table1[Emp Name]),COUNT(Table1[Emp Name]))

 

Non - Certified = DIVIDE(COUNTX(FILTER(Table1,Table1[Certified ] = "N"),Table1[Emp Name]),COUNT(Table1[Emp Name]))

 

Hope it will help you:)

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

 

Drag Office to the visual and write the following measures:

 

Certified Employees = CALCULATE(COUNTROWS(Data),Data[Certified]="Y")/COUNTROWS(Data)

Non-Certified Employees = CALCULATE(COUNTROWS(Data),Data[Certified]="N")/COUNTROWS(Data)

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-shex-msft
Community Support
Community Support

HI @shiv1002,

 

You can try to use below formula to create summary table with percentage of certified state.

Summary =
VAR _temp =
    SUMMARIZE (
        'Sample',
        [Office Name],
        "Y", CALCULATE ( COUNT ( 'Sample'[Certified] ), 'Sample'[Certified] = "Y" ),
        "N", CALCULATE ( COUNT ( 'Sample'[Certified] ), 'Sample'[Certified] = "N" )
    )
RETURN
    SELECTCOLUMNS (
        _temp,
        "Office Name", [Office Name],
        "Certified", [Y]
            / ( [Y] + [N] ),
        "Non-Certified", [N]
            / ( [Y] + [N] )
    )

2.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi @v-shex-msft,

 

Creating a new table is a good idea, however, this would not work in my solution as I need to show only those offices which are selected from the list of offices. I will keep this in mind as this can be useful in other reports.

 

Regards,

Shiv Yadav

SivaMani
Resident Rockstar
Resident Rockstar

@shiv1002,

 

Create two calculated measure using DAX,

 

Certified = DIVIDE(COUNTX(FILTER(Table1,Table1[Certified ] = "Y"),Table1[Emp Name]),COUNT(Table1[Emp Name]))

 

Non - Certified = DIVIDE(COUNTX(FILTER(Table1,Table1[Certified ] = "N"),Table1[Emp Name]),COUNT(Table1[Emp Name]))

 

Hope it will help you:)

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.