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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
Helpful_Fun4848
Helper III
Helper III

Questions re matrix data manipulation

Hi all,

I have 2 questions regarding the matrix that I'm currently working on.

 

My data is a result of a survey and it looks like this:

 

RespondentDivisionCategorySurvey Result
A1A1
B2B2
C3C3

 

10 survey questions are 1 to 5 scale, 1 question 1 to 3 scale and 1 question is Yes (1) and No (0). I don't have problem calculating average score, Power BI can calculate it for each Category and/or Division perfectly, but when it comes to average %, then the calculation is not correct as Power BI calculate percentage of the grand total. 

 

First question: how do I create different calculation based on the scale on the same matrix? 

 

Second question: when I add Count of Respondent onto the matrix, it is showing up after each column. How do I make it so count of respondent only showing up on the last column only?

 

DivisionSurvey Result Category ACount of RespondentSurvey Result Category BCount of Respondent
11111
22222
33333

 

Thanks all!

1 ACCEPTED SOLUTION

@Anonymous 

 

I found the solution for question 1. I created 2 measures. Measure 1 for avg score, measure 2 for avg %. 

 

Measure 1 = 

if(or(max([Parent Category])="Parent Category1", max([Parent Category])="Parent Category2"),"N/A",AVERAGE([Value]))

Measure 2 = 
if(max([Parent category])="Parent Category1",AVERAGE([Value]),
if(max([Parent Category])="Parent Category2",AVERAGE([Value])/100,
(if(max([Parent Category])="Parent category3",AVERAGE([Value])/3,AVERAGE([Value])/5)))
)
 

I also found why count of respondent is showing up after each category. It is because on one category, there are 2 people who didn't completed the survey one 1 of the category. 

 

Much thx!

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

Please share representative data and on that data show the expected result.


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

Hi @Helpful_Fun4848,

Did you mean to create a matrix as same as the sample you shared below? If that is the case, you can create a matrix with 'division', 'survey' fields as row, category field as the column, 'Respondent' field with summary mode 'count' on value fields.

#1, I'm not so clear about your requirement, can you please explain more about these?

How to Get Your Question Answered Quickly

#2, So you mean only showing the result on the corresponding category included in your table? For this scenario, you can write a measure formula and add the category filter in it to prevent the calculation of not-matched records.

Regards,

Xiaoxin Sheng

@Anonymous 

Question 1: The matrix is like this:

 

CategoryAverage ScoreAverage %
AScale 1-5Scale 1-5
BScale 1-5Scale 1-5
CScale 1-5Scale 1-5
DShould be blank1=Yes, 2=No
EShould be blankAlready in pecentage
FScale 1-5Scale 1-5
GScale 1-5Scale 1-5
HScale 1-3Scale 1-3

 

I created Average score which works for all, but, I need category D & E to be blank. How do I make it hidden to appear that it is blank?

 

I also created Average% measure, however, it won't work for all knowing Category D, E, & H requires different calculation. How do I, on the same matrix and column, add a measure just for Category D and H which is different than the rest?

 

If I create measure specifically for Category D, E, & H and adding it to the matrix, it will create additional 3 columns for that 3 measures. I want to keep the 2 columns result. 

 

Question 2: I want the matrix to look like this:

 

DivisionCategory ACategory BCategory CCount of Respondent
11111
22222
33333

 

However, currently, after I add Count of respondent, it show up after each columns like what I was showing on my original posting. 

 

Much thx!

Anonymous
Not applicable

Hi @Helpful_Fun4848,

#1, If you mean replace field value based on condition another field, you can directly do these in query editor with replacing value functions or write a measure expression with if statement to extract field value and ignore special value displayed.

Solved: Query editor replacing values based on another col... - Microsoft Power BI Community

measure =
VAR currCategory =
    SELECTEDVALUE ( Table[Category] )
VAR currScope =
    SELECTEDVALUE ( Table[Average Scope] )
RETURN
    IF ( currCategory IN { "D", "E" }, BLANK (), currScope )

#2, You can use the if statement or switch function with selectedvalue to check current row content and add expressions to replace calculations with these particular values.

My Favorite DAX Feature: SELECTEDVALUE with SWITCH | Winston-Salem Power BI User Group (pbiusergroup...

#3, You can drag the category fields to column fields and write measure expressions to switch expression results based on the current category.

Regards,

Xiaoxin Sheng

@Anonymous 

 

I found the solution for question 1. I created 2 measures. Measure 1 for avg score, measure 2 for avg %. 

 

Measure 1 = 

if(or(max([Parent Category])="Parent Category1", max([Parent Category])="Parent Category2"),"N/A",AVERAGE([Value]))

Measure 2 = 
if(max([Parent category])="Parent Category1",AVERAGE([Value]),
if(max([Parent Category])="Parent Category2",AVERAGE([Value])/100,
(if(max([Parent Category])="Parent category3",AVERAGE([Value])/3,AVERAGE([Value])/5)))
)
 

I also found why count of respondent is showing up after each category. It is because on one category, there are 2 people who didn't completed the survey one 1 of the category. 

 

Much thx!

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.