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
Moye
Frequent Visitor

Calculate Percentage with Several Filter Arguments

Hi,

New to PowerBI. I'm looking to create a measure that can take 2 counts and display a percentage.

 

I first want to count the number of rows in my table where each column below is equal 100.

[Team Complete (%)]

[Ph0]

[Phase 1-2],

[Ph 3],

[Ph 4a],

[Ph 4b-5],

[Ph 6], [

Ph 6-1]

 

I then want to take that count and divide it by the count of rows of the column below that are equal to 100.

[Team Complete %]

 

 

 

I'm not sure if its possible to put several arguments in a count function, but this is the measure I made:

 

Complete/Phase_Percent = CALCULATE(COUNT('all_projects'[Team Complete (%)]), filter('all_projects','all_projects'[Team Complete (%)]=100 && ('all_projects'[Ph 0]=100 && 'all_projects'[Phase 1-2]=100 &&'all_projects'[Ph 3]=100 && 'all_projects'[Ph 4a]=100 && 'all_projects'[Ph 4b-5]=100 && 'all_projects'[Ph 6]=100 && 'all_projects'[Ph 6_1]=100)))

 

/ CALCULATE(COUNT('all_projects'[Team Complete (%)]), FILTER('all_projects','all_projects'[Team Complete (%)]=100))*100

 

 

 

All numbers are under the datatype of "whole numbers".

 

Any help would be much appreciated.

1 REPLY 1
Eric_Zhang
Employee
Employee

@Moye

That DAX looks good. To have a better readability, you can format it in DAX formatter. You don't have to *100 at the end, just format the measure as percentage. So what is the exact question in your case, to have a better understanding, please post some sample data and the expected output.

Capture.PNG

Complete/Phase_Percent =
CALCULATE (
    COUNT ( 'all_projects'[Team Complete (%)] ),
    FILTER (
        'all_projects',
        'all_projects'[Team Complete (%)] = 100
            && ( 'all_projects'[Ph 0] = 100
            && 'all_projects'[Phase 1-2] = 100
            && 'all_projects'[Ph 3] = 100
            && 'all_projects'[Ph 4a] = 100
            && 'all_projects'[Ph 4b-5] = 100
            && 'all_projects'[Ph 6] = 100
            && 'all_projects'[Ph 6_1] = 100 )
    )
)
    / CALCULATE (
        COUNT ( 'all_projects'[Team Complete (%)] ),
        FILTER ( 'all_projects', 'all_projects'[Team Complete (%)] = 100 )
    )
    

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.