Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Adding a percentage column which calculate the row %

Hi,

I am quite new to PBI. I am facing a dilemma. I have a table like below which has the data about pizza delivery guys delivery status. If they delivered on time then its a pass otherwise fail

 

Capture.PNG

 

What I want is to pivot the 'Name' column with the total jobs done by each person and a column with their fail % as below:

 

     Name| Total Jobs | Pass | Fail | Fail%

--------------------------------------------

 John     | 2                | 1      | 1    |  50%

 Mike    | 3                 | 0      |   3  |   100%

 

Many Thanks

N

 

1 ACCEPTED SOLUTION
v-kelly-msft
Community Support
Community Support

Hi  @Anonymous ,

 

You need 4 measures:

 

Total Jobs = COUNT('Table'[Name])
fail = CALCULATE(COUNT('Table'[status])+0,ALLEXCEPT('Table','Table'[Name]),'Table'[status]="fail")
Pass = CALCULATE(COUNT('Table'[status])+0,ALLEXCEPT('Table','Table'[Name]),'Table'[status]="pass")
fail % = DIVIDE([fail],[fail]+[Pass])

 

Then put them with name in a table visual,you will see:

 

Annotation 2020-03-05 131052.png

 

For the related .pbix file,pls click here.

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

 

 

View solution in original post

3 REPLIES 3
v-kelly-msft
Community Support
Community Support

Hi  @Anonymous ,

 

You need 4 measures:

 

Total Jobs = COUNT('Table'[Name])
fail = CALCULATE(COUNT('Table'[status])+0,ALLEXCEPT('Table','Table'[Name]),'Table'[status]="fail")
Pass = CALCULATE(COUNT('Table'[status])+0,ALLEXCEPT('Table','Table'[Name]),'Table'[status]="pass")
fail % = DIVIDE([fail],[fail]+[Pass])

 

Then put them with name in a table visual,you will see:

 

Annotation 2020-03-05 131052.png

 

For the related .pbix file,pls click here.

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

 

 

Anonymous
Not applicable

Thank you! That worked..

 

Please can you explain the logic behind the below as I am new to DAX. 

fail = CALCULATE(COUNT('Table'[status])+0,ALLEXCEPT('Table','Table'[Name]),'Table'[status]="fail")

  

amitchandak
Super User
Super User

Create measure like

Job count = calculate(count(Table[JobID]))
pass count = calculate(count(Table[JobID]),table[status]="pass")
fail count = calculate(count(Table[JobID]),table[status]="fail")
pass % = divide([pass count ],[Job count])
fail % =divide([fail count],[Job count ])

 

use with name in table, matrix or other visuals

 

Appreciate your Kudos.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.