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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Katalo
Frequent Visitor

Dynamic count of values based on selections/slicer

Im quite new to Power BI, but Im getting the hang of it. Im building a report based on interview asnwers and got stuck on problem and I hope someone here could give me a push in the right direction.

 

I have a tabel of interview answers, with columns for each question and rows for each respondent. The respondent also answers question about for example age, gender and that sort of things. 

 

For most questions the respondent answer on a scale from 1-5, and I would like to create a measure that counts all the occurances of 1 and 2. I want to be able to select the questions in a slicer och a chart will show how many has answered 1 and 2 and split that by the total amount of values in the column (to get a percentage).

 

I fugured i cound use count and filter, but I can only filter by a specific column (question) and i would like to be able to change the coulmn but count values in the same way. Above that i would be nice to be able to filter the respondents by age and so on. 

 

Here in an example of what the data looks like, its about 100 questions and 10 000 rows in the original

 

Respondentresponse_dateagegenderQ1Q2Q3Q4Q5Q6
513213512018-01-0118m4432512
513215142018-01-0233f 3 5123
513216772018-01-0345m212 45 
513218402018-01-0448m5432512
513220032018-01-0552m1325 23
513221662018-01-0619f2 23454
513223292018-01-0736f343251 
513224922018-01-0874m 325123
513226552018-01-0962f5123 54
….          

 

Thanks in advance!

1 ACCEPTED SOLUTION
Thejeswar
Super User
Super User

@v-chuncz-msft,

Is this what you mean? (See pic. below)

noofans.PNG

 

The Above chart shows the no. of times a value occurs for each question.

 

To get this use Unpivot option in the Power Query

 

The Following Screenshot shows the same

 

After importing the data, Select all the non- Question Columns and then Under Transform Menu of the Ribbon, click on "Unpivot Other Columns" OptionAfter importing the data, Select all the non- Question Columns and then Under Transform Menu of the Ribbon, click on "Unpivot Other Columns" Option

 After importing the source data into Power BI, as shown in the above pic, click the Unpivot Other Columns option under the Transform Menu of Power Query after selecting all the non-Question Columns

 

After Unpivoting the other columns, the data will look like as shown below

 

unpivot1.png

 

 

 

Now build the first posted graph using this table.

View solution in original post

3 REPLIES 3
Thejeswar
Super User
Super User

@v-chuncz-msft,

Is this what you mean? (See pic. below)

noofans.PNG

 

The Above chart shows the no. of times a value occurs for each question.

 

To get this use Unpivot option in the Power Query

 

The Following Screenshot shows the same

 

After importing the data, Select all the non- Question Columns and then Under Transform Menu of the Ribbon, click on "Unpivot Other Columns" OptionAfter importing the data, Select all the non- Question Columns and then Under Transform Menu of the Ribbon, click on "Unpivot Other Columns" Option

 After importing the source data into Power BI, as shown in the above pic, click the Unpivot Other Columns option under the Transform Menu of Power Query after selecting all the non-Question Columns

 

After Unpivoting the other columns, the data will look like as shown below

 

unpivot1.png

 

 

 

Now build the first posted graph using this table.

v-chuncz-msft
Community Support
Community Support

@Katalo,

 

You may select Unpivot Columns in Query Editor first.

https://community.powerbi.com/t5/Desktop/matrix-to-table-help/td-p/329415

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Maybe you could upload sample data set for better understanding?

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.