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

Absence KPIs

I am doing a dashboard that has 2 tables the personnel table which has a staff number column and Absence table which also has a staff number column - I have created a realtionship from personnel table to absence  table using the staff number on a 1 to many as there is only 1 staff number per person on the personnel table and many absences per employee on the absence table. 

 

I need to do a chart with the calculation count of total absence days from absence table ( sliced by year and department) divided by personnel table count of employees but also based on the year and department sliced currently on the absence table.   So lets say resouces department has 113 people in 2021 (personnel table ) and resources department had 400 days absence in 2021 the calculation would be 400 divded by 113.  when I try this the numbers are all wrong because instead of 113 its calcualting on all the staff in the personnel table 800 as the slicers work for the absence table and not the personnel table - how do I get round this.  Many Thanks

2 ACCEPTED SOLUTIONS
v-cgao-msft
Community Support
Community Support

Hi @Michalison ,

 

I made a sample according to the description with four tables which are personnel table,department table,absence table and calendar table.

vcgaomsft_5-1643261660280.png

Relationship.

vcgaomsft_0-1643331898104.png

Then try this measure.

 

Absence KPIs = 
VAR _KPIS = COUNTROWS ( 'absence table' ) / COUNTROWS ( 'personnel table' )
RETURN
IF(_KPIS = BLANK(),0,_KPIS)

 

The result should be like this and slicer also works fine.

vcgaomsft_7-1643261929466.png

 

vcgaomsft_6-1643261889674.png

Also, attached the pbix file as the reference.

 

Best Regards,

Community Support Team_Gao

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

View solution in original post

Thank you so much for your help this has worked

View solution in original post

2 REPLIES 2
v-cgao-msft
Community Support
Community Support

Hi @Michalison ,

 

I made a sample according to the description with four tables which are personnel table,department table,absence table and calendar table.

vcgaomsft_5-1643261660280.png

Relationship.

vcgaomsft_0-1643331898104.png

Then try this measure.

 

Absence KPIs = 
VAR _KPIS = COUNTROWS ( 'absence table' ) / COUNTROWS ( 'personnel table' )
RETURN
IF(_KPIS = BLANK(),0,_KPIS)

 

The result should be like this and slicer also works fine.

vcgaomsft_7-1643261929466.png

 

vcgaomsft_6-1643261889674.png

Also, attached the pbix file as the reference.

 

Best Regards,

Community Support Team_Gao

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

Thank you so much for your help this has worked

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.