cancel
Showing results for
Did you mean:
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) 31 62% San Francisco (75 employees) 34 45% Michigan (1000 employees) 90 9%

1 ACCEPTED SOLUTION
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:

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:

And you can get what you want.

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.

4 REPLIES 4
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:

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:

And you can get what you want.

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.

Super User

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

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!
Helper II

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

Helper II

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

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

Announcements

#### Launching new user group features

Learn how to create your own user groups today!