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
Lumi-Stuart
Regular Visitor

Filtering a row in a table based upon another row of the same table

Hi all

 

I'm querying a dataset of answers to custom-built forms. Think of it as two tables:

* FORM

* FORM_ANSWER

 

The tables contain lots of different forms made up of different questions - some forms may only have a few questions, some may have dozens. The FORM table contains one row per form; the FORM_ANSWER table contains one row per answer per form.

 

Here is some sample data for three forms, all of the same design template.

FORM:

FORM_IDFORMTEMPLATE
1My Form 1Template 1
2My Form 2Template 1
3My Form 3Template 1

 

FORM_ANSWER

FORM_ANSWER_IDFORM_IDQUESTIONRESPONSE_DATA_TYPERESPONSE
11Question 1stringForm 1 answer 1
21Question 2booleanTRUE
31Question 3numeric12
42Question 1stringForm 2 answer 1
52Question 2booleanFALSE
62Question 3numeric 
73Question 1stringForm 3 answer 1
83Question 2booleanTRUE
93Question 3numeric33

 

I want to be able to create visuals showing responses to different questions that can interact with other visuals for other question.

 

Example: I want to see the answers for "Question 1" where the response to "Question 2" is true:

LumiStuart_0-1743786431133.png

Without a cunning plan, if I select "TRUE" responses to "Question 2" in the left-hand visual, the right-hand table filters to no results instead of the two I would like to see (FORM_ID 1 and 3).

 

I would like to avoid creating a different table for every answer because we're taking about lots of different form templates with lots of answers. I'd also prefer to avoid pivoting the table to give one row per form template.

 

Is there an approach that can filter the tables in a structure similar to that provided?

 

Thanks

 

Stuart

1 ACCEPTED SOLUTION

Hi @Lumi-Stuart ,
Thanks for reaching out to the Microsoft fabric community forum.
I've explored several alternative solutions to meet your requirement without using a pivot column, including approaches with DAX measures and slicers. Unfortunately, none of these methods have proven effective in achieving the desired outcome.
As challenging as it may seem, the most viable and reliable solution is to modify your data model to include a pivoted table structure. This approach will provide the flexibility and performance needed for your visualizations to work as intended.

If you find this post helpful, please mark it as an "Accept as Solution" and consider giving a KUDOS. Feel free to reach out if you need further assistance.
Thanks and Regards

 

View solution in original post

7 REPLIES 7
Lumi-Stuart
Regular Visitor

I've provided a link to a sample Power BI report (including the suggestion by @danextian for reference).

 

Play.pbix 

danextian
Super User
Super User

Hi @Lumi-Stuart 

 

May possible method but the simplest is to pivot your data so each question will have its own column. In the query editor, duplciate your original query the keep only the form id and question and response columns. Select response then in the transform tab, selected pivot

danextian_0-1743851902384.png

danextian_1-1743852039882.png

 

 

But you might want to keep the unpivoted format of your data for other forms of analyses like selecting a question from a slicer.

 

Please see the attached sample pbix.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Thanks for the feedback, but I'd like to avoid pivoting the data if I can. We could be looking at 20+ different templates (i.e. sets of questions), so the only way to practically pivot the data would be to create 20+ pivoted tables (one for each template type).

 

I'm attempting to build a generic solution (if that's possible).

Hi @Lumi-Stuart ,
Thanks for reaching out to the Microsoft fabric community forum.
I've explored several alternative solutions to meet your requirement without using a pivot column, including approaches with DAX measures and slicers. Unfortunately, none of these methods have proven effective in achieving the desired outcome.
As challenging as it may seem, the most viable and reliable solution is to modify your data model to include a pivoted table structure. This approach will provide the flexibility and performance needed for your visualizations to work as intended.

If you find this post helpful, please mark it as an "Accept as Solution" and consider giving a KUDOS. Feel free to reach out if you need further assistance.
Thanks and Regards

 

I've ended up compromising and generating a generic pivot of up-to-five questions deep. I.e.:

 

Q1A1Q2A2Q3A3Q4A4Q5A6
Form typeForm 1Question 2TrueQuestion 312    
Form typeForm 2NameJamesOther namesFalse    
Form typeForm 2NameGillOther namesTrueWhatGillian  

 

This means that I only have to build a single pivot to cover a range of templates.

It's an unfortunate limitation, though, as it would be a really powerful generalisation solution.

 

Thanks

andrewsommer
Super User
Super User

Yes, this should be rather straight forward.  Try following these steps:

  1. In desktop bring in both tables to your model
  2. Create a one way relationship between FORM and FORM_ANSWER on the FORM_ID field
  3. Create your visuals
  4. In the Ribbon > Formal select Edit Interactions.
    1. Change the interaction to filter from highlight if it is not already on filter
  5. The two visuals should not be acting the way you want

 

Please mark this post as solution if it helps you. Appreciate Kudos.

Thanks for the suggestion, but I can't get that to work. I'm pretty sure that it misses the fundamental issue of the filter item from FORM_ANSWER needs to filter a different row in FORM_ANSWER.

 

I've attached a version of the Power BI report to another answer. Unless I'm missing something, I don't think that you'll be able to get your steps to return any results.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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