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.
Hi All! I am struggling a little with an equation. Overall I am trying to divide count(column1)/count(respondents) in simple terms but it is turning out to be a little harder than that which is where I would appriciate your help. (Also this is my first time posting so if I am missing any info just let me know and I will provide!)
So the behind the scenes of the data is that there is a question being asked and each column is one of the answers to the select all questions. So for example:
What did you enjoy about your stay?
Column 1: The Pool
Column 2: The Food
Column 3: The Staff
Column 4: The Golf Course
Column 5: Nothing
So one reason why we cant just divide by the number of respondents is because there may be a respondent who never got that question and so they shouldn't count in denominator since they never had it. We just want the % of people who selected each option from this survey.
So here is some sample data:
respondent | column1 | column2 | column3 | column4 | column5 | question2 |
1 | 1 | 1 | null | null | null | null |
2 | null | 1 | null | 1 | null | null |
3 | null | 1 | null | null | null | Yes |
4 | null | null | 1 | 1 | null | Yes |
5 | null | null | null | null | 1 | null |
6 | 1 | 1 | 1 | 1 | null | null |
7 | null | null | null | null | 1 | null |
8 | null | null | null | null | null | Yes |
9 | null | null | null | null | null | Yes |
* data is in string(text) format not number format
So what I am currently thinking is
COUNTA(Column1*) / IF (column1) ="1" OR (column2) ="1" OR (column3) ="1" OR (column4) ="1" OR (column5) ="1" THEN count(respondents)
* i would replace this with each column and then put into y-axis field because i want a legend for each of them
But this doesn't work because one, if statement doesn't work with text, and two, i can't do an or statement with more than 2 statements/expressions but that equation is just how my mind is thinking.
Another thing to note is I cant do the sum of the count of each columns because I dont want people who selectd multiple answers count twice because it is a select all that apply question so we want a the % of people that selected that answer not the % of all responses.
I have also tried a switch( true() but i need the OR in there i think.
If you have any suggestions or if i left anything out just let me know! thanks!
The syntax is a little off.
DIVIDE(COUNTA(Column1) , IF ( [column1]="1" || [column2] ="1" || [column3] ="1" || [column4] ="1" || [column5] ="1",count(respondents)),0)
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 | |
9 | |
7 | |
7 | |
6 |
User | Count |
---|---|
21 | |
11 | |
10 | |
9 | |
8 |