Forum Discussion
BradleyN1
2 years agoFrequent Visitor
Counting values based on unique ID then dividing
Hi, I am working on survey data, and I want an overall satisfaction percentage. As I've had to unpivot the columns, I've got duplicate statements in 1 column, but I only want to count the numbe...
Dangar332
Resident Rockstar
2 years agoBradleyN1
2 years agoFrequent Visitor
It could be like this:
| ID | Statement | Response |
| 1 | Statement 1 | Agree |
| 1 | Statement 1 | Agree |
| 1 | Statement 2 | Strongly Agree |
| 1 | Statement 2 | Strongly Agree |
| 1 | Statement 3 | Disagree |
| 1 | Statement 3 | Disagree |
| 1 | Statement 4 | Strongly Disagree |
| 1 | Statement 4 | Strongly Disagree |
| 2 | Statement 1 | Strongly Agree |
| 2 | Statement 1 | Strongly Agree |
| 2 | Statement 2 | Disagree |
| 2 | Statement 2 | Disagree |
| 2 | Statement 3 | Agree |
| 2 | Statement 3 | Agree |
| 2 | Statement 4 | Disagree |
| 2 | Statement 4 | Disagree |
So per ID count each statement response (only Strongly Agree or Agree [positives]) then dividing by all of them per ID
- Dangar3322 years ago
Resident Rockstar
Hi, BradleyN1
try below
just adjust your table and column name
Measure = var a = CALCULATE(COUNT('count'[Response]),or('count'[Response]="agree" ,'count'[Response]="strongly agree")) var b = COUNT('count'[Response]) return DIVIDE(a,b)- BradleyN12 years agoFrequent Visitor
Oh, you are amazing! It works perfectly, thanks so much 🙂