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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
JRICHA30
Frequent Visitor

Dividing two measures (sums of two columns) and using a hierarchy drill down as the filter

Hi,

 

I am trying to calculate percentages of attendance for different levels of the hierarchy. (Organisation -> function -> department -> team).

 

For this, there is two measures:

 

Total Attendees = SUM(Headcount[Attendees])

Total Headcount = SUM(Headcount[Headcount])

 

Attendance = Divide( [Total Attendees], [Total Headcount],0)

 

Headcount is always > 0 

but attendance can =0

 

However, lets say at the team level, there is 4 teams, with a total headcount of 20 people.

lets say only 2 teams have registered attendance, so the data looks like:

 

OrgFunctionDepartmentTeamHeadcountAttendance
Org 1Function 1Department 1Team 155
Org 1Function 1Department 1Team 255
Org 1Function 1Department 1Team 350
Org 1Function 1Department 1Team 450

 

The outcome should be Team 1 & 2 = 100%, Team 3&4 = 0% department 1 = 50% 

 

However, the measure is ignoring teams with 0 attendees & giving 

Team 1 & 2 = 100%

Team 3 & 4 = Blank

Department 1 = 100%

 

Any help here will be much appreciated.

 

(filters are applied to a bar graph by drilling down into the orgnisation, with the columns above used. There are 9 functions, each with 6-20 departments, each with 1-10 teams), so you can see if there is 0 attendance, it can make a huge difference to the figure at the top, as their headcount is being ignored.

Clicking "show items with no values" on the graph enables to see blank attendance at team level, but still does not roll the headcount up to department level.

 

any help much appreciated!

 

 

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

How can the Attendance (%) be 50% for Department1.  Should it not be 10/120 i.e. 8.33%?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-angzheng-msft
Community Support
Community Support

Hi, @JRICHA30 

 

Unable to reproduce your situation, how did you get the percentage of department 1 to be 100%?

the above measures seem to work fine to me.

vangzhengmsft_1-1630289206265.png

Could you please consdier sharing more details about it or a simple sample file without any sesentive information and drawing a simple picture to show your expected visual so that i may work out with a workaround?

 

 

Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I have delved into this further and looked at it as a table:

Org  Function  Department  Department Tier 2HeadcountSum HeadcountSum Attendees% AttendanceAttendance % (done from table)
ORG 1Function 1Department 1Team 1464464132.80%2.80%
ORG 1Function 1Department 1Team 2111119.09%9.09%
ORG 1Function 1Department 1Team 371 00.00% 
ORG 1Function 1Department 1Team 4219 00.00% 
ORG 1Function 1Department 2Team 51010660.00%60.00%
ORG 1Function 1Department 2Team 647 00.00% 
ORG 1Function 1Department 2Team 72072078943.00%43.00%
ORG 1Function 1Department 3Team 810 00.00% 
ORG 1Function 1Department 3Team 936362877.78%77.78%
ORG 1Function 1Department 3Team 1014 00.00% 
ORG 1Function 1Department 3Team 115 00.00% 
ORG 1Function 1Department 3Team 121 00.00% 
ORG 1Function 1Department 3Team 1320 00.00% 
ORG 1Function 1Department 3Team 1443 00.00% 
ORG 1Function 1Department 3Team 1566583.33%83.33%
ORG 1Function 1Department 3Team 16101010100.00%100.00%
ORG 1Function 1Department 3Team 1714 00.00% 

 

It seems that whenever it 'summarises', it outputs a blank when there is 0 attendees.

However, all it needs to do is output what is correct in the headcount column. I know how to force it to output a specific number, but it will not allow me to reference the column? I've checked the data-types (what feels like 1 million times) to ensure it is a number also.

 

 

 

 

JRICHA30
Frequent Visitor

Just as an add in, i tried to use the "ALL" function, but this then does not allow the hierarchy drillthrough feature to filter the measure. essentially i want all rows with headcount to be totalled, within the selected filter range.

Department Level (1-level above furthest drill down)Department Level (1-level above furthest drill down)Team Level (Furthest Drill Down)Team Level (Furthest Drill Down)

Hi All,

I have copied a small sample of the data below.

To clarify, the furthest drill down (at team level) shows all the teams, but only 3 have a bar (and are correct, and can be compared with the % shown in the sample table.)

 

However at department level, the bar illustrates only using the 3 teams with attendance > 0. Giving 43/52 = 82.69%.

However it should be doing, 43/159 = 27%.

(I've attached images but not full ones due to sesnsitivty)

(For clarity, the value on the graph is a measure and not the calculated column below)

 

FunctionDepartmentDepartment Tier 2Period YearHeadcountNo. AttendeesAttendance %
Function 1Department 1Team 12122 P05140.000%
Function 1Department 1Team 22122 P0510.000%
Function 1Department 1Team 32122 P05430.000%
Function 1Department 1Team 42122 P05200.000%
Function 1Department 1Team 52122 P051010.00100%
Function 1Department 1Team 62122 P053628.0078%
Function 1Department 1Team 72122 P0565.0083%
Function 1Department 1Team 82122 P05100.000%
Function 1Department 1Team 92122 P05140.000%
Function 1Department 1Team 102122 P0550.000%

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors