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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Formula to calculate % using selected values within a column

Hello,

 

I am new with PowerBI and not familiar with DAX... I would like to do a simple calculation using the data from one column only.

 

The column reports on a laboratory participation to a training and on the success (or not) at this training:

0 = the lab did not participate to the training

1 = the lab participated to the training but did not pass the test

2 = the lab participated to the training and pass the test

 

I would like to get the proportion of lab that pass the test:

= "number of lab that participated to the training and pass the test" / "total number of lab that participated to the training")

= total number of "2" / total number of "1" + "2"

 

Can someone help?

 

Many thanks!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

If you data looks like the matrix, then your results would look like the cards.

 

Participate.PNG

I'd do a measure for each result and then put them together to get the Pass Proportion

 

Measures
0 NoParticipate = CALCULATE(count(Sheet1[Lab Name]),Sheet1[Result] =0)
 
1 ParticipateNoPass = CALCULATE(count(Sheet1[Lab Name]),Sheet1[Result] =1)
 
2 ParticipatePass = CALCULATE(count(Sheet1[Lab Name]),Sheet1[Result] =2)

Pass Proportion = Divide([2 ParticipatePass],([1 ParticipateNoPass]+[2 ParticipatePass]),0)
 
 Please mark as solved if this works for you or let me know if you need clarifications. Cheers!

View solution in original post

1 REPLY 1
Anonymous
Not applicable

If you data looks like the matrix, then your results would look like the cards.

 

Participate.PNG

I'd do a measure for each result and then put them together to get the Pass Proportion

 

Measures
0 NoParticipate = CALCULATE(count(Sheet1[Lab Name]),Sheet1[Result] =0)
 
1 ParticipateNoPass = CALCULATE(count(Sheet1[Lab Name]),Sheet1[Result] =1)
 
2 ParticipatePass = CALCULATE(count(Sheet1[Lab Name]),Sheet1[Result] =2)

Pass Proportion = Divide([2 ParticipatePass],([1 ParticipateNoPass]+[2 ParticipatePass]),0)
 
 Please mark as solved if this works for you or let me know if you need clarifications. Cheers!

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

Top Solution Authors