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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

Getting percent on row while counting some columns

I have a situation where I have a table with individual feedback scores and want to produce a matrix showing rating groups and their percentage of the  year's total feedback but I don't want to add counts for a 0 score (meaning the question wasn't answered). I have looked at quite a few examples that seem similar but not quite the same. From looking at examples in this community, I have tried a few things I've seen and I have it close to correct but I think I am not doing it right. 

DateCustomerFeedback score
12/02/2019ABC5
12/05/2019SDF7
04/20/2020FDR0
05/21/2020GTR6
06/12/2020EWR2
07/23/2021QWE7
08/21/2021FDS1
06/25/2022ABC0
07/12/2022HJK5

 

this would then consolidate to (counts shown):

Year01-56-7Total
20190112
20201113
20210112
20221102

What I would like to add is a percentage for the rating groups of 1-5 and 6-7 of their amounts of the total that doesn't include counts in the 0 column. For example, the first row both 1-5 and 6-7 would be 50%. 2020 it would also be 50% because the total count would be 2 (don't include the 0 column). 2022 would be 100% for the rating group of 1-5. 

 

I created two measures: 

# of non-zero feedbacks = 

CALCULATE(
COUNTROWS( 'Customer Feedback' ),
ALLEXCEPT( 'Customer Feedback', 'Customer Feedback'[score] ), 'Customer Feedback'[score] > 0
)

 

% of non-zero = count('Customer Feedback'[score])/ 'Customer Feedback'[# of Non-zero feedbacks]
 
Then I created a matrix that shows (this doesn't match the data above):
leeguth_0-1646404239026.png

 

What it seems to do is correctly show on the very bottom total line (the 83% for 6-7 rating should be 83.3%, so it is probably just format but correct number) but for 2022, it should be 86.7% and not 5% (26 / 30). The 0 column doesn't really need a percentage because it isn't included in response rating percentages - so it really should be 0% and then the 1-5 and 6-7 percentages should be there. 

I had laid it out this way because it seemed easy to view the counts and percentages, but it can be changed to show the percentage next to the appropriate columns if making the calculations work is easier. 

 

Can someone help me figure the right measures and how to make the matrix to present this?

2 ACCEPTED SOLUTIONS

Hi @Anonymous 

 

I got this!

Percentage Measure = 
VAR Numerator =
    CALCULATE(
        [FeedbackCount],
        'Customer Feedback'[feedback score] <> 0
    )
VAR Denominator =
    CALCULATE(
        [FeedbackCount],
        CALCULATETABLE(
            'Customer Feedback',
            'Customer Feedback'[feedback score] <> 0,
            REMOVEFILTERS('Customer Feedback'[feedback score (groups)])
        )
    )
RETURN

DIVIDE(
    Numerator,
    Denominator,
    BLANK()
)

 

littlemojopuppy_1-1646412701581.png

 

View solution in original post

@Anonymous try another measure...should be something like this (maybe???)

CALCULATE(
	[The Measure I Gave You Earlier],
	[Group/bin] = "6-7"
)

 

View solution in original post

17 REPLIES 17
Anonymous
Not applicable

ok so i stripped out all colummns except a couple but kept the full records so I can figure out what they should be easier. 🙂  I uploaded it to google drive so hopefully this works... https://docs.google.com/spreadsheets/d/1kVmuUrrEvUIbjOnYPh9YOeP4WoE42goL/edit?usp=sharing&ouid=10924... 

I was going to copy up also my trial PBI file but it kept showing a path with some restricted info in it for my data source so I don't think I can upload it - couldn't get it to point to the Google drive file. 

 

For the 6-7 column the percentage by year should be:

2022 = 86.7%

2021 = 84.8%

2020 = 79.8%

2019 = 86.2%

total of all years = 83.3%

 

The 2-5 (guess I have no 1's lol) would be the difference between 100 and the 6-7 percentages....

 

I used groups on the feedback score to provide the groupings...

Hi @Anonymous 

 

I got this!

Percentage Measure = 
VAR Numerator =
    CALCULATE(
        [FeedbackCount],
        'Customer Feedback'[feedback score] <> 0
    )
VAR Denominator =
    CALCULATE(
        [FeedbackCount],
        CALCULATETABLE(
            'Customer Feedback',
            'Customer Feedback'[feedback score] <> 0,
            REMOVEFILTERS('Customer Feedback'[feedback score (groups)])
        )
    )
RETURN

DIVIDE(
    Numerator,
    Denominator,
    BLANK()
)

 

littlemojopuppy_1-1646412701581.png

 

Anonymous
Not applicable

thanks!  I would've never gotten that....and I think I mostly understand what you did. lol

@Anonymous glad I could help!  😊

Anonymous
Not applicable

I have a somewhat related question...if possible I'd like to use the value in the total row at the bottom of the 6-7 column (83.3%) in a card up top on the page...is there any easy way to get it? I'm guessing I need another measure(my guess), but would it be similar to what you helped with?

@Anonymous try another measure...should be something like this (maybe???)

CALCULATE(
	[The Measure I Gave You Earlier],
	[Group/bin] = "6-7"
)

 

Anonymous
Not applicable

ok! I tried that a little, but it's the second parameter that I didn't add....thanks! those extra parameters get me every time.  Tried it as I typed and that did it. Thanks!!

Anonymous
Not applicable

me too! I knew there had to be a way, but I'm just not good enough to know enough functions to do it. I have two others that I need something similar so I should be able to take what you provided to do it for those....hopefully. 🙂  Thank you again!

littlemojopuppy
Community Champion
Community Champion

Hi @Anonymous 

 

Try this...

Average Measure =
AVERAGEX(
	FILTER(
		'Customer Feedback',
		'Customer Feedback'[score] > 0
	),
	'Customer Feedback'[score]
)

Hope this helps!

Anonymous
Not applicable

do I replace the percentage one I have with this one or do I add it somewhere in addition?

@Anonymous replace

Anonymous
Not applicable

I tried replacing and now it is giving me the average score I think and not the percentage...see the change below in numbers....

leeguth_0-1646405861662.png

 

@Anonymous I'm an idiot.  I have no idea why I gave you a formula for average...

 

This should be better

Percentage =
DIVIDE(
	COUNT('Customer Feedback'[score]),
	COUNTROWS(
		FILTER(
			'Customer Feedback',
			'Customer Feedback'[score] > 0
		)
	),
	BLANK()
)
	

 

 

Anonymous
Not applicable

thanks. I was trying so many things yesterday and tried the Average a couple of times... 🙂 

 

I replaced it with your DIVIDE and it's still not right:

leeguth_0-1646406976742.png

I also tried playing with the 'Show value as" options but they didn't help either. 

@Anonymous can you provide some sample data to play with?

Anonymous
Not applicable

I'll try to make some...what I have is a lot and so I will try to shrink it and figure what it should produce too...might take me a bit...thanks.

@Anonymous a couple hundred records should be enough.  Copy and paste data into Excel, change any sensitive data (company or person names, etc.) and share a link to Google Drive, One Drive, etc.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

Top Kudoed Authors