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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
qwertzuiop
Advocate III
Advocate III

Group by ID

Hello dear Power BI Community

 

I have the following problem to solve - let's assume this situation:

Participants in a questionnaire give various answers to diffrent questions.

They can answer these with good, bad or not at all.

 

To make this more clear and explain it in more detail:

For example, participant P1 answered question A with "good", question B with "bad" and gave no answer to C.

In addition, a reason why is required when rating a question as "bad" (see. lorem ipsum)

Note: An answered question as bad can have several reasons why (see P2 question C)

 

Participant-IDQuestionQuestion answered?GoodBadReason why if bad
P1AXX  
P1BX Xlorem ipsum_1
P1C    
P2AXX  
P2BXX  
P2CX Xlorem ipsum_2
P2CX Xlorem ipsum_3
P3A    
P3BXX  
P3CXX  

 

The goal is to create a grouped table like this below:

A cross table showing the number of answered questions (good or bad) in relation to the number of participants.

 

To make it more clear for example:

2 participant (P1 & P3) answered 2 questions

1 participant (P2) answered 3 questions -> Here is the main challenge:  The result should be 3 and not 4 (because the participant answered question C twice in this data structure, but in fact it is only because of the two reasons why).

 

Num_of_ParticipantQuestion answered
22
13

 

Any ideas how to solve this problem?

Thank you very much for your contribution.

 

Cheers

qwertzuiop

 

 

 

 

1 ACCEPTED SOLUTION
rsbin
Super User
Super User

@qwertzuiop ,

Please see attached pbix.

Solution involves creating one Calculated Column.

Then creating your Table (or other) visual.

Hope this works for your larger dataset.  Let me know if you have any questions.

Regards,

View solution in original post

3 REPLIES 3
KNP
Super User
Super User

This measure may do the trick but depends on your actual data...

Questions Answered = 
    CALCULATE(
        DISTINCTCOUNTNOBLANK(Questions[Question]), 
        Questions[Question answered?] = "X"
    )
Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x
rsbin
Super User
Super User

@qwertzuiop ,

Please see attached pbix.

Solution involves creating one Calculated Column.

Then creating your Table (or other) visual.

Hope this works for your larger dataset.  Let me know if you have any questions.

Regards,

Thank you very much @rsbin 

Works as expected.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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