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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Michalison
Helper II
Helper II

Calcuations

 

I have this visual which is based on a teat sdlicer and Directorate slicer on an absence table - the calculation is Number of sick days divided by number of employees in the directorate  - when I select year and directorate the no of sick days are correct but the no of employees are wrong (the number of employees are fron the personnel_table) whcich has a 1 to many realtionship with the absence table based on Staff_Number

 

Total Sick Days = 'Calculation'[Count Sick Days]/'Calculation'[Absence FTE]
 
Absence FTE = CALCULATE(SUM(Personnel_Records[FTE]), USERELATIONSHIP(Absence[Start Date], 'Absence Date'[Date]))
 
This is giving me all the staff whatever directorate they are in so instead of 601 (absence days)/ 113 FTE I am getting 601/ 1053
 
Can anyone tell me where I am going wrong

 

 

Michalison_0-1643188854032.png

 

1 ACCEPTED SOLUTION

Thank you for your reply I have used your suggestion and its looking better but still not quite right 

 

Michalison_0-1643275053805.png

As you can see the absence FTE is now 70 when it should be 113 - I know what its doing its couting the FTE of those asbent from the resources department and not all people in the resources directorate I think the formula

 

CALCULATE(distinctcount(Personnel_Records[Employee ID]), USERELATIONSHIP(Absence[Start Date], 'Absence Date'[Date]))

 

perhaps the userelationship should not be based on the absence table I am not sure.   Many Thanks for your help

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

You should have a Calendar Table.  Does this work?

Absence FTE = CALCULATE(SUM(Personnel_Records[FTE]), USERELATIONSHIP(Absence[Start Date]'Calendar'[Date]))

Hope this helps?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

@Michalison , it should be the distinct count of employee id ?

like 

CALCULATE(distinctcount(Personnel_Records[Employee ID]), USERELATIONSHIP(Absence[Start Date], 'Absence Date'[Date]))

 

If this does not help
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks that worked

Thank you for your reply I have used your suggestion and its looking better but still not quite right 

 

Michalison_0-1643275053805.png

As you can see the absence FTE is now 70 when it should be 113 - I know what its doing its couting the FTE of those asbent from the resources department and not all people in the resources directorate I think the formula

 

CALCULATE(distinctcount(Personnel_Records[Employee ID]), USERELATIONSHIP(Absence[Start Date], 'Absence Date'[Date]))

 

perhaps the userelationship should not be based on the absence table I am not sure.   Many Thanks for your help

Hi @Michalison,

 

You want to calculate number of all employees in the directorate?

 

Can you try allexcept(), allexcept() only allow the filter context you specify,maybe some measures like the following:

Absence FTE =
CALCULATE(
    COUNT( Personnel_Records[Employee ID] ),
    ALLEXCEPT( Personnel_Records, Personnel_Records[teat] )
)

It is hard to find what wrong without some sample data or pbix, if you need more help, please share some sample data or your pbix without sensitive data.

 

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.