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 a table like this:
survey_id | question_name | answer | person_id |
1 | question1 | yes | 1 |
1 | question1 | no | 2 |
1 | question1 | no | 3 |
1 | question1 | no | 4 |
1 | question1 | yes | 5 |
2 | question1 | yes | 1 |
2 | question1 | yes | 2 |
2 | question1 | yes | 3 |
2 | question1 | no | 4 |
1 | question2 | no | 6 |
1 | question2 | no | 7 |
1 | question2 | yes | 8 |
1 | question2 | yes | 9 |
2 | question2 | yes | 5 |
2 | question2 | no | 6 |
2 | question2 | no | 7 |
So I calculate a simple % of yes answeres per survey. Also, I calculated average of previous measure between surveys.
For %:
and be able to filter it by survey, so only blue bar will change, average is static.
I hope I covered all and delivered the problem well. Thanks in advance. ( The visual could be a bit different, it could be a space betwen blue and gray bars
Solved! Go to Solution.
HI @Anonymous,
Did you mean to modify the formula to auto-fit each question types in your formula? If that is the case, you can try to use following measure formula to replace the raw percentage formula:
%_ =
VAR tom =
CALCULATE (
DISTINCTCOUNT ( table[person_id] ),
FILTER ( 'table', 'table'[answer] = "yes" ),
VALUES ( 'table'question )
)
VAR tot =
CALCULATE (
DISTINCTCOUNT ( table[person_id] ),
ALLSELECTED ( 'table' ),
VALUES ( 'table'question )
)
RETURN
tom / tot
Regards,
Xiaoxin Sheng
HI @Anonymous,
Did you mean to modify the formula to auto-fit each question types in your formula? If that is the case, you can try to use following measure formula to replace the raw percentage formula:
%_ =
VAR tom =
CALCULATE (
DISTINCTCOUNT ( table[person_id] ),
FILTER ( 'table', 'table'[answer] = "yes" ),
VALUES ( 'table'question )
)
VAR tot =
CALCULATE (
DISTINCTCOUNT ( table[person_id] ),
ALLSELECTED ( 'table' ),
VALUES ( 'table'question )
)
RETURN
tom / tot
Regards,
Xiaoxin Sheng
Hi @Anonymous
Try this measure
If this post helps, then please consider Accept it as the solution, Appreciate your Kudos!!
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 |
---|---|
14 | |
10 | |
10 | |
10 | |
9 |
User | Count |
---|---|
18 | |
13 | |
12 | |
11 | |
8 |