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
RichXM655
Helper I
Helper I

Categories or metadata for Columns.

Hi.

I've got an upcoming project where I will be feeding the results of a large survey (about 500 questions, 30k responses) into powerBI to make a report.

 

The client has defined some of the questions as being grouped by overall topics, though these are not contiguous within the way the survey is designed. 

 

As simplified example, imagine I;ve got a simple survey about following up on an online purchase - all answering on a 1-10 scale

 

1: how easty was it to find the product on oyr website

2: how visually appealing did you find the website

3: how satsified are you with the product?

4: how likely are you to buy that product again, or recommend to a friend?

 

SO Question 1 and 2 are relating to the "website" category , and 3 and 4 to the "product" category.

 

The data would be returned from the survey software in the format where each row would be a response to the survey, and each question is a column.

 

The easiest solution to providing collated "category" level data would be to create measures that calculate an overall average for the columns, but that's going to get very laborious to create these manually for the real survey.

 

Seeing as I already have a lookup table for the questions and the categories they bleong to, is there some way of joining the two up so that these work as (basically) metadata, or perhaps filter pre-sets .

1 ACCEPTED SOLUTION

@RichXM655 ,

 

In query editor, click on all the questions() and then click transform-> Unpivot Columns, you will get two new columns [Attribute] and [Value] as below:

1.PNG 

 

After applied&close, you need to build a one-many relationship between these two tables as below:

2.PNG  

 

Then you can create a measure to calculate the average value of Mentor in category A like pattern below:

Average_Value_Of_Mentor = CALCULATE(AVERAGE(Table1[Value]), FILTER(Table2, Table2[Category A] = "Mentor"))

3.PNG 

 

You can also refer to the pbix attached.

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-yuta-msft
Community Support
Community Support

@RichXM655 ,

 

I'm not clear about your requirement. Could you please share some sample data and clarify more details about your requirement?

 

Regards,

Jimmy Tao

So, imagine I've got this export from a survey (I;ve changed the example survey, as it's not important)

ResponseIDDateHow Satisfied are you with knowledge level of your mentor?How would you rate the availablity of your mentor?How satisfied are you with the accesibility of the training centre?How satisfied arew you with the facilities of the training centreHow satisfied arew you with the content of the course?How easily have you been able to access the course materials?How useful has the training prgramme been to you in the time since starting?Would you recommend this programme to others?
101/01/202042424432
202/01/202044433241
303/01/202014233143
404/01/202032324132
505/01/202033241344
606/01/202033433242
707/01/202024114434
808/01/202033141223
909/01/202033132444
1010/01/202014414322

 

The client, in addition to wanting to see the usual reporting for each individual question, would also like to see combined results for particular categories (or topics). They've provided a list of which questions relate to which topics in this format:

 

QuestionCategory ACategory B
How Satisfied are you with knowledge level of your mentor?MentorContent
How would you rate the availablity of your mentor?Mentor 
How satisfied are you with the accesibility of the training centre?CentreAccesibility
How satisfied arew you with the facilities of the training centreCentre 
How easily have you been able to access the course materials?ContentAccessibility
How satisfied arew you with the content of the course?Content 
How useful has the training prgramme been to you in the time since starting?Overall 
Would you recommend this programme to others?Overall 

 

So - I know I could manually create measures (or indeed, additional columns in the response data) that would create combined / averaged values for these categories. But doing this for the real survey will be extremely laborious, as there's a lot more than 5 categories.

 

What I'm trying to find out is if there's some way of doing this so that I can create measures where the code is basically "Just use the "Mentor" values for this calculation.", or "show me values sorted by category".

@RichXM655 ,

 

In query editor, click on all the questions() and then click transform-> Unpivot Columns, you will get two new columns [Attribute] and [Value] as below:

1.PNG 

 

After applied&close, you need to build a one-many relationship between these two tables as below:

2.PNG  

 

Then you can create a measure to calculate the average value of Mentor in category A like pattern below:

Average_Value_Of_Mentor = CALCULATE(AVERAGE(Table1[Value]), FILTER(Table2, Table2[Category A] = "Mentor"))

3.PNG 

 

You can also refer to the pbix attached.

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

This looks like a fantastic solution, thanks.

I think first thing you should do is unpivot the first table 

https://radacad.com/pivot-and-unpivot-with-power-bi

 

Then it join with second table on questions. As the second table is like master to it. 

 

In case you again need to pivot your calculation you can use matrix.

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.