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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
aflintdepm
Helper III
Helper III

Measure for Percent of Task by Location or Department

I have a matrix with Employee as my Row, Location as my Column, and Count of Task (as a percent of row total).

 

EmployeeLocation 1Location 2Location 3Total
Bob25%70%5%100%
Mary50%50% 100%
Joe100%  100%

 

I would like to create an actual measure that does the same thing as % of row total, without having to have everything on a row.

 

The data would look like this:

EmployeeLocationTask Count
BobLocation 150
BobLocation 2140
BobLocation 310
MaryLocation 1100
MaryLocation 2100
JoeLocation 1150

 

How can I write this in a measure so that my matrix could be:

Rows:

Employee

Location

 

Values:

% per location

Bob100%
Location 125%
Location 270%
Location 35%
Mary100%
Location 150%
Location 250%
Joe100%
Location 1100%

 

Thank you

1 ACCEPTED SOLUTION

I think I have it-

I created a measure to represent the denominator I'm looking for:
Denominator = CALCULATE(COUNT([Tasks]), REMOVEFILTERS([Location])

Then, I replaced this in the second half of your measure above and got

 

Percent per Office = DIVIDE(
    CALCULATE(SUM([TASK COUNT])),
    [DENOMINATOR]
)
 
This matched my original matrix exactly, but allowed me to group the locations per my desired format.  Thank you for you help and getting me moving in the right direction.

View solution in original post

3 REPLIES 3
az38
Community Champion
Community Champion

Hi @aflintdepm 

 

try a measure

Measure = 
DIVIDE(
    CALCULATE(SUM('Table'[Task Count])),
    CALCULATE(SUM('Table'[Task Count]), ALLEXCEPT('Table', 'Table'[Employee]))
)

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

@az38 

Thank you for the direction.  It's close, but not exactly what I'm expecting.  It appears that it is measuring the number of tasks at the location as the denominator.

 

Here is what I get in my first matrix, set to "show as % of row total"- no measures, just task counts

aflintdepm_0-1706573705241.png

Here's the exact same employee in the same 2 locations using the measure you described

aflintdepm_1-1706573779583.png

 

I'm not sure if the ALLEXCEPT in the second half of the DIVIDE syntax should be the employee, or the location?

 

Basically, for the DIVIDE function, the numerator would be all tasks performed by the employee in that location and the denominator would be all tasks peformed by the employee in any location

 

Any suggestions?

I think I have it-

I created a measure to represent the denominator I'm looking for:
Denominator = CALCULATE(COUNT([Tasks]), REMOVEFILTERS([Location])

Then, I replaced this in the second half of your measure above and got

 

Percent per Office = DIVIDE(
    CALCULATE(SUM([TASK COUNT])),
    [DENOMINATOR]
)
 
This matched my original matrix exactly, but allowed me to group the locations per my desired format.  Thank you for you help and getting me moving in the right direction.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.