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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
EMason
Frequent Visitor

Unpivoted Survey Responses Cohort Matching - Visual Filters based on response

Hi all,

 

In essence, my question is this:

Is it possible to have a bar chart with responses that I can cohort match by clicking on the visual, and have the same visual update to show the cohorts answers to the rest of the questions?

If not, what could be a good way to visually show a cohorts answers that can be easily done by someone non-technical?

Details below.

 

I have a very large, unpivoted table as my fact_table that contains responses to surveys. I also have a number of dimensions such as questions, answers, dates etc.

Here is a basic replication of the fact_table (that works without the dimensions):

EMason_2-1770185656482.png

 

 

A large part of what is wanted from the dashboard is the ability to select responses and see how that cohort answered other questions. The Submission ID is the ID relating to the submission of a survey, hence, letting us know what other questions the user answered.


See the following image as a basic example using a wide table approach: 

In the Q1 visual, the '5' part of the bar is selected and it highlights/filters the other bar charts.

EMason_1-1770185380609.png

 

Is it possible to have this kind of interactivity in an unpivoted table as well as not having to make a new chart for every question? We have a lot of surveys of differing sizes and being able to select a survey from a slicer and see all of the questions while still being able to interact would be amazing.

 

Non-working, unpivoted table version

EMason_4-1770185828628.png

 

Explanation of why the above does not currently work, from my understanding: 
When I click on "Yes" for Q1, it filters the bar chart visual for both that answer and question, in other words, making everything else blank as each answer is on its own row in the fact_table, which is filtered out due to not matching question & answer.

 

Table with data for example:

Spoiler
User IDSurvey IDSubmission IDQuestionAnswerScore
111Q1Yes5
111Q2Yes5
111Q3No0
111Q4No0
212Q1Yes5
212Q2Yes5
212Q3Yes5
212Q4Yes5
313Q1Yes5
313Q2No0
313Q3Yes5
313Q4No0
414Q1Yes5
414Q2Yes5
414Q3Yes5
414Q4Yes5
515Q1No0
515Q2Yes5
515Q3No0
515Q4Yes5
616Q1Yes5
616Q2Yes5
616Q3Yes5
616Q4Yes5
717Q1Yes5
717Q2No0
717Q3Yes5
717Q4Yes5
818Q1Yes5
818Q2Yes5
818Q3No0
818Q4Yes5
129Q1Yes3
129Q2Maybe2
129Q3No1
129Q4Yes3
129Q5Yes3

 

Thanks so much for taking the time to read this. Let me know if I can explain anything further!

1 ACCEPTED SOLUTION
EMason
Frequent Visitor

Thanks to all who replied, especially @v-karpurapud who came the cloests to what I was looking for.

 

I came up with a solution that works for me and allows me to dig into cohorts.

Here is the model view:

 

EMason_4-1771198969743.png

Here is it in action:

Without filters

EMason_0-1771198703727.png

Filtering for cohort who said "Yes" to Q1

EMason_1-1771198727980.png

Filtering for cohort who said "Yes" to Q1 AND said "No" to Q2

EMason_2-1771198739836.png

 

How it works

The key is having the slicer be the "Disconnected" tables.

Then, in the measure, filter the fact table to get all rows that have any of the selected questions & answers. Then, select the Submissions that have the exact number of Questions (as those Submissions have all selected answers matching).

 

Measures:

Screen Count = DISTINCTCOUNTNOBLANK('Fact'[Submission ID])

 

Cohort Count = 
// The currently selected answers in the disconnected table (selected from the slicer)
VAR SelectedAnswers =
    VALUES ( 'Disconnected Answers'[Answer ID] )

// The questions that are selected (from the slicer)
VAR SelectedQs =
    VALUES ( 'Disconnected Questions'[Question ID] )

VAR WantedSubmissions = 
// Select the Submission IDs
SELECTCOLUMNS(
    // Filter the table to only include Submissions with the exact number of questions required 
    FILTER(
        // Group by submission id and get the distinct count of questions
        SUMMARIZE(
            // Get all fact rows that contain the selected answer ids
            CALCULATETABLE(
                'Fact'
                ,ALL('Fact')
                ,TREATAS(SelectedAnswers,'Fact'[Answer ID])
            )
            ,'Fact'[Submission ID]
            ,"QCount", COUNTA('Fact'[Question ID])
        ),
        [QCount] = COUNTROWS(DISTINCT(SelectedQs))
    )
    ,'Fact'[Submission ID]
)

RETURN
// If statement as [Screen Count] returns blank with ,TREATAS(WantedSubmissions, 'Fact'[Submission ID]) when nothing is selected.
IF(
    OR(ISFILTERED('Disconnected Answers'),ISFILTERED('Disconnected Questions'))
    ,CALCULATE(
        [Screen Count]
        ,TREATAS(WantedSubmissions, 'Fact'[Submission ID])
    )
    ,CALCULATE(
        [Screen Count]
        ,'Fact'[Submission ID]

    )
)

 

 

View solution in original post

6 REPLIES 6
EMason
Frequent Visitor

Thanks to all who replied, especially @v-karpurapud who came the cloests to what I was looking for.

 

I came up with a solution that works for me and allows me to dig into cohorts.

Here is the model view:

 

EMason_4-1771198969743.png

Here is it in action:

Without filters

EMason_0-1771198703727.png

Filtering for cohort who said "Yes" to Q1

EMason_1-1771198727980.png

Filtering for cohort who said "Yes" to Q1 AND said "No" to Q2

EMason_2-1771198739836.png

 

How it works

The key is having the slicer be the "Disconnected" tables.

Then, in the measure, filter the fact table to get all rows that have any of the selected questions & answers. Then, select the Submissions that have the exact number of Questions (as those Submissions have all selected answers matching).

 

Measures:

Screen Count = DISTINCTCOUNTNOBLANK('Fact'[Submission ID])

 

Cohort Count = 
// The currently selected answers in the disconnected table (selected from the slicer)
VAR SelectedAnswers =
    VALUES ( 'Disconnected Answers'[Answer ID] )

// The questions that are selected (from the slicer)
VAR SelectedQs =
    VALUES ( 'Disconnected Questions'[Question ID] )

VAR WantedSubmissions = 
// Select the Submission IDs
SELECTCOLUMNS(
    // Filter the table to only include Submissions with the exact number of questions required 
    FILTER(
        // Group by submission id and get the distinct count of questions
        SUMMARIZE(
            // Get all fact rows that contain the selected answer ids
            CALCULATETABLE(
                'Fact'
                ,ALL('Fact')
                ,TREATAS(SelectedAnswers,'Fact'[Answer ID])
            )
            ,'Fact'[Submission ID]
            ,"QCount", COUNTA('Fact'[Question ID])
        ),
        [QCount] = COUNTROWS(DISTINCT(SelectedQs))
    )
    ,'Fact'[Submission ID]
)

RETURN
// If statement as [Screen Count] returns blank with ,TREATAS(WantedSubmissions, 'Fact'[Submission ID]) when nothing is selected.
IF(
    OR(ISFILTERED('Disconnected Answers'),ISFILTERED('Disconnected Questions'))
    ,CALCULATE(
        [Screen Count]
        ,TREATAS(WantedSubmissions, 'Fact'[Submission ID])
    )
    ,CALCULATE(
        [Screen Count]
        ,'Fact'[Submission ID]

    )
)

 

 

v-karpurapud
Community Support
Community Support

Hi @EMason 

I wanted to check if you’ve had a chance to review the information provided. If you have any further questions, please let us know. Has your issue been resolved? If not, please share more details so we can assist you further.

Thank You.

danextian
Super User
Super User

I am unclear of what you want to achieve but assuming for the same submission, you want  to know how a user answered other questions, you can try the attache pbix.

danextian_0-1770204079508.png

 





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 replying! I think I have explained poorly.

It's not the individual submissions that I need to look at. I need to look through hundreds of thousands. What I'm looking for is

  1. a way to look at a specific subset of questions that are in a survey (I can select the Survey ID to filter the questions) ✔️
  2. See the answer distribution as you have in the "count of Submission ID by Question and Answer" bar chart in the pbix. ✔️
  3. Click on a part of that barchart to select a cohort e.g. All people for Q3 who said "No"  ✔️
  4. Have this cohort's answers for all other question's be shown (I have put a visual showing what I would like this to look like further down) 
    e.g. For all people who answered "No" for Q3:
    1. Q1: 33% said "No", 67% said "Yes"
    2. Q2: 100% said "Yes"
    3. Q4: 33% said "No", 67% said "Yes"
    4. etc

 

My idea for this is to get the submission ID's of the selected cohort as I can create a subset of the fact table where those submissions exist (with all questions and answers for the given survey id). I was mainly wondering if it is possible to have the same visual filter when I click on the cohort or if it will always only highlight what I have clicked (see images below)

 

Image showing no highlighting for other bars:

EMason_0-1770239519592.png

 

Here is what I had come up with (can't share the pbix as it is with my actual data). On the first visual, I have clicked on the 4th question's score of 1 and the second visual is highlighting how that cohort answered.

EMason_1-1770241414934.png

Is there any way to have this behaviour with just the single visual? Or perhaps a nicer way of displaying what I already have?

 

Thanks again!

 

Hi @EMason 
Thank you for reaching out to the Microsoft Fabric community forum.
 

I have implemented solution using sample data to demonstrate the correct cohort analysis approach, where selecting a specific Question and Answer identifies a subset of submissions and recalculates their responses across the remaining questions.

 

The PBIX file attached for your review. Please take a look and let me know your observations or any feedback you may have.

 

If you have any more questions, please let us know and we’ll be happy to help.

 

Regards,

Microsoft Fabric Community Support Team.

Hi,

I am not sure how much can help but i would like to try.  Could you please share some sample data to work with and show the result in a simple table format.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.