Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I have unpivoted a table of survey data becuase the respondents could select more than one of several options for one of the questions. I am now trying to do a distinct count, however, it only counts distinct Staff IDs, I need a distinct count based on the 'Staff ID' and 'Question 2' i.e. 2 staff members responded 'Yes'
Staff ID | Question 1 | Question 2 |
1 | Test 1 | Yes |
1 | Test 2 | Yes |
1 | Test 3 | Yes |
2 | Test 4 | Yes |
2 | Test 5 | Yes |
2 | Test 6 | Yes |
3 | Test 7 | No |
3 | Test 8 | No |
3 | Test 9 | No |
Would be very grateful if someone could advise how best to do this!
Thank you!
Solved! Go to Solution.
calculate( distinctcount( tbl_name[ staff ID ] , tbl_name[Question 2] = "Yes" )
let me know if this helps .
If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution ✅
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠
the code written by quick measure is equal to : calculate( distinctcount( tbl_name[ staff ID ] , tbl_name[Question 2] = "Yes" )
did you change the tbl_name to your table name ?
then do a distinct value on a concatenation of the fields so concatenate the fields into one and do a distinct count them.
Proud to be a Super User!
calculate( distinctcount( tbl_name[ staff ID ] , tbl_name[Question 2] = "Yes" )
let me know if this helps .
If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution ✅
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠
Thanks for the suggestions.
I couldn't get either to work for me, however, I figured out a solution using a quick measure as below;
the code written by quick measure is equal to : calculate( distinctcount( tbl_name[ staff ID ] , tbl_name[Question 2] = "Yes" )
did you change the tbl_name to your table name ?
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
78 | |
76 | |
59 | |
35 | |
33 |
User | Count |
---|---|
100 | |
62 | |
56 | |
47 | |
41 |