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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
ckyin999
Frequent Visitor

Calculation with the missing the attendance data

Hello everyone,

I need to create a report that shows how many staff members meet the monthly target of entering the office ( swipe card record) at least 8 times per month. Additionally, I need to calculate the percentage of total staff by department that has met this target.

 

I have created a simple metric to calculate this. However, I noticed that there is a staff member who has never entered the office In June, which means there is no access record for them in Table 2. What should I do to include these records in the table to ensure I get accurate results?

 

Attend Count = COUNTROWS('Table 2')

Did not meet the 8 times monthly target= COUNTROWS(FILTER(VALUES('Table 2'[badge No]),[Attend Count] <=7))

 

Example : badge NO = 62396 , '1' indicates that the staff did not meet the 8-times monthly target. Currently, the result shows '0' for June and '1' for July, which is incorrect because the staff didn’t enter the office at all in June.

 

ckyin999_0-1726843818610.png

 

Following are my table details.

 

  • Table 1: Employee details.
badge No.NameOrganizational unit 1Organizational unit 2
62195AJTPIT
62375BJTPIT
63291CJTPMarketing
63317CJTPMarketing
62472EJTPSales
62562GJTPAdmin
65098HJTPSales
62396IJTPIT
62552JJTPIT
62132KJTPFacility
62473LJTPFacility
63320MJTPLogistic
63235NJTPLogistic
  • Table 2: Daily Employee Access ( June & July record only)
badge No.Date
621324-Jun-24
624736-Jun-24
621327-Jun-24
624737-Jun-24
6213210-Jun-24
6213211-Jun-24
6255213-Jun-24
6247313-Jun-24
6255214-Jun-24
6255220-Jun-24
6247320-Jun-24
6213224-Jun-24
6213225-Jun-24
6213226-Jun-24
6247326-Jun-24
6255227-Jun-24
6213227-Jun-24
6247327-Jun-24
6255228-Jun-24
621321-Jul-24
625525-Jul-24
621329-Jul-24
6247310-Jul-24
6255211-Jul-24
6213215-Jul-24
6213216-Jul-24
6239617-Jul-24
6255218-Jul-24
6247318-Jul-24
6255219-Jul-24
6247319-Jul-24
6213222-Jul-24
6213223-Jul-24
6247324-Jul-24
6255225-Jul-24
6213229-Jul-24
6247329-Jul-24
6213230-Jul-24
6247331-Jul-24

 

My expected result is the following

 

MonthJuneJuly
DepartmentTotal StaffsNot Met targetMet %Total StaffsNot Met targetMet %
IT440%440%
Marketing220%220%
Sales220%220%
Admin110%110%
Facility 2150%2150%
Logistic2150%2150%

 

I would appreciate any help you can provide. Thank you.

 

2 ACCEPTED SOLUTIONS
Ashish_Mathur
Super User
Super User

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1726890044452.png

 


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

View solution in original post

You are welcome.  Please mark my previous reply as Answer.


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

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1726890044452.png

 


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

Hi Ashish,

 

Many thanks! Yes, it helps. I got the correct answer from your Power BI file and learned how the measures work.

You are welcome.  Please mark my previous reply as Answer.


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

Create following measures.  Create a Date table (Calendar table and link to table2 on date).  Also for Logistic Department I see them show as 50% in final output.  In the sample provided they never swiped card only IT and Facilities.

Total Staff = CALCULATE(COUNTROWS('Table'))

Not Meet Target =

VAR BadgeCount = CALCULATE(COUNTROWS(Table2))

VAR Met = IF(BadgeCount>7,1,0)

RETURN

If(MET=0,[Total Staff],[Total Staff]-MET)

MET % = DIVIDE([Not Meet Target]-[Total Staff],[Total Staff],0)


Bmejia_1-1726869351694.png

 

 

 

Hi Bmejia,

 

Thanks for your response.

It worked based on the sample data provided. However, when I pulled in more data, I noticed different results.

For example: The Change Management department has 9 staff members, but only 2 met the target in June & July. The measurement result, however, is showing 8 instead of 7 in both months.  I can't figure out what is the problem.

ckyin999_0-1726898687203.png

 

 

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.