cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
leont3
Helper II
Helper II

DAX Calculation Percentage in Matrix but different numbers for each row

Hi all,

I am trying to calculate the % in a matrix table. 

 

This is my model: 

- Survey Data [Table Name - Survey Results] which also specify the location someone works in e.g. Michigan, San Francisco and New York

-  [Table Name - Employee Listing] A full listing of employees each with their location

 

I have managed to work out the overall completion rate by using two COUNTROWs functions to count both rows and then to divide. So in this case, the overall completion rate would be: 

13.78% completion rate

 

I want to work out the % completion rate in a matrix and am not entirely sure how to do that with each location.

 

 

For example:

Location

Survey Responses% Completion within Location
New York (50 employees)3162%
San Francisco (75 employees)3445%
Michigan (1000 employees)909%

 

Thanks in advance 

1 ACCEPTED SOLUTION
v-robertq-msft
Community Support
Community Support

Hi, @leont3 

According to your description, you want to work out the % completion rate in a matrix grouped by location, you can follow my steps:

This is my test data:

v-robertq-msft_0-1607328934791.png

 

  1. Create these measures:
Survey Responses =

COUNT(Response[Response ID])
% Completion within Location =

var _Employee=COUNT(Employee[Employee ID])

var _percent=DIVIDE([Survey Responses],_Employee)

return FORMAT(_percent,"Percent")
overall completion rate =

var _response=COUNTX(ALLSELECTED(Response),[Response ID])

var _employee=COUNTX(ALLSELECTED(Employee),[Employee ID])

return

FORMAT(DIVIDE(_response,_employee),"Percent")

 

Then create a Matrix and place columns like this, and you can also create a card chart to show the value of the overall completion rate:

v-robertq-msft_1-1607328934850.png

 

And you can get what you want.

You can download my test pbix file here

 

Best Regards,

Community Support Team _Robert Qin

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

4 REPLIES 4
v-robertq-msft
Community Support
Community Support

Hi, @leont3 

According to your description, you want to work out the % completion rate in a matrix grouped by location, you can follow my steps:

This is my test data:

v-robertq-msft_0-1607328934791.png

 

  1. Create these measures:
Survey Responses =

COUNT(Response[Response ID])
% Completion within Location =

var _Employee=COUNT(Employee[Employee ID])

var _percent=DIVIDE([Survey Responses],_Employee)

return FORMAT(_percent,"Percent")
overall completion rate =

var _response=COUNTX(ALLSELECTED(Response),[Response ID])

var _employee=COUNTX(ALLSELECTED(Employee),[Employee ID])

return

FORMAT(DIVIDE(_response,_employee),"Percent")

 

Then create a Matrix and place columns like this, and you can also create a card chart to show the value of the overall completion rate:

v-robertq-msft_1-1607328934850.png

 

And you can get what you want.

You can download my test pbix file here

 

Best Regards,

Community Support Team _Robert Qin

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

amitchandak
Super User
Super User

@leont3 ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin

Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!

Thanks for your help. These are what the tables look like:

Survey responses:

 

Obviously, there are more lines but I hope you get the gist

Sorry photos didnt come through for some reason this is what I was hoping:

cAPTURE 4.PNG

Capture3.PNG

These are two separate queries, obviously, the location names would be different.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

November Power BI Update 768x460.png

Check it Out!

Click here to read more about the November 2021 Updates!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.