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
zwambold
New Member

Calculate Pass/Fail rate as a percentage by week

Hi All, 


Need help with what I believe is a relatively simple formula but I'm a bit green. 

 

Ultimately, I want to show a week over week pass rate as a percentage. Something like below: 

 

Count of Pass by SR_ID per week/Count of Overall SR_ID per week

 

zwambold_0-1655393271216.png

I want to then graph this out in a bar chart showing percentage pass by week. 

 

1 ACCEPTED SOLUTION
rohit_singh
Solution Sage
Solution Sage

Hi @zwambold ,

Create a measure like below :

 

Pass % =


var _pass =

CALCULATE(
COUNT(Results[SR_ID]),
FILTER(
ALLEXCEPT(Results, Results[Week]),
Results[Overall] = "Pass"
)
)

var _total =

CALCULATE(
COUNT(Results[SR_ID]),
ALLEXCEPT(Results, Results[Week])
)

var _res = DIVIDE(_pass,_total, 0)

return
if(isblank(_res), 0, _res)
 
Output :
rohit_singh_1-1655397488861.png


If you want to sort the week in ascending/descening order, create a year-week index column in power query and sort the week column by that.

Kind regards,

Rohit


Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 🙂

 

View solution in original post

1 REPLY 1
rohit_singh
Solution Sage
Solution Sage

Hi @zwambold ,

Create a measure like below :

 

Pass % =


var _pass =

CALCULATE(
COUNT(Results[SR_ID]),
FILTER(
ALLEXCEPT(Results, Results[Week]),
Results[Overall] = "Pass"
)
)

var _total =

CALCULATE(
COUNT(Results[SR_ID]),
ALLEXCEPT(Results, Results[Week])
)

var _res = DIVIDE(_pass,_total, 0)

return
if(isblank(_res), 0, _res)
 
Output :
rohit_singh_1-1655397488861.png


If you want to sort the week in ascending/descening order, create a year-week index column in power query and sort the week column by that.

Kind regards,

Rohit


Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 🙂

 

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