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
Anonymous
Not applicable

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, @Anonymous 

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, @Anonymous 

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.

amitchandak
Super User
Super User

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

Anonymous
Not applicable

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

Anonymous
Not applicable

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
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.