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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

how can I filter a column with filtering another column

Hi There,

 

I have a table like this:

UserIDResponseIDQuestionTagAnswerID
u1r1q11
u1r2q21
u1r3q32
u1r4q43
u2r12q12
u2r13q22
u2r14q31
u2r15q42
u3r27q11
u3r28q22
u3r29q33
u3r30q44

 

And I want to filter userID by answerID but like this:

I want to find users whose QuestionTag=q1 and AnswerID=1 and then I want to reach users' answerID distrubution whose QuestionTag=2

 

 

FilteringUsersProblem.png

 

And So In this picture, If I click answerID=1 in pie chart in QuestionTag=1, The other pie charts must show filtering users answerID distrubution by questionTag

 

Thanks

2 REPLIES 2
AllisonKennedy
Super User
Super User

This can be done with the right Edit Interactions and pivoting the data in Power Query.

Once you have the pivoted data, just create a pie chart for each question using the newly pivoted table and put UserID in values as Count and Q1 in Legend for question 1, Q2 in legend for question 2 pie chart, etc. Then Edit Interactions on each pie chart to set highlight to Filter, and the rest will fall into place.

Here is M code for your reference (I used the sample data you provided and called that table QuestionRawData, so you just need to edit the Source step below to match the name of your table and make sure column names are still the same).

let
Source = QuestionRawData,
#"Removed Other Columns" = Table.SelectColumns(Source,{"UserID", "QuestionTag", "AnswerID"}),
#"Pivoted Column" = Table.Pivot(#"Removed Other Columns", List.Distinct(#"Removed Other Columns"[QuestionTag]), "QuestionTag", "AnswerID")
in
#"Pivoted Column"

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Anonymous
Not applicable

Hi @AllisonKennedy 

 

Thank you for your response but this table is only a sample.

 

I have a lot of question tag and sometimes a user has one more AnswerID for a questionTag.

 

UserIDResponseIDQuestionTagAnswerID
u4r31q11
u4r32q22
u4r33q24

 

If I do pivot table, I can lost answerID 2 or 4 for q2

 

Do you have any other solution?

 

Best,

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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