March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello Everyone,
i have large attendance Database. I want to calculate how many present/absent every day.
but few IDs are having duplicate values as shown below. so the same id count is showing in present and absent also.
i have total X number of head count. for X headcount present must be some Y and Absent must be X-Y. But my Absent plus Present count is more than Headcount due to the duplicate Records. So please Help.
Solved! Go to Solution.
Hi @tejutulasi67 ,
Based on your description, I have created a simple sample:
Please try:
Status =
var _a = SUMMARIZE('Table',[Employee ID],[In Time],[Out Time],"Hours Worked",DATEDIFF([In Time],[Out Time],HOUR))
return IF(SUMX(_a,[Hours Worked])<>0,"Present","Absent")
Count of Absent =
var _a = SUMMARIZE('Table',[Employee ID],[In Time],[Out Time],"Hours Worked",DATEDIFF([In Time],[Out Time],HOUR))
var _b = SUMMARIZE(_a,'Table'[Employee ID],"Hours worked",SUMX(FILTER(_a,[Employee ID]=EARLIER('Table'[Employee ID])),[Hours Worked]))
return COUNTX(FILTER(_b,[Hours worked]=0),[Employee ID])
Count of Present =
var _a = SUMMARIZE('Table',[Employee ID],[In Time],[Out Time],"Hours Worked",DATEDIFF([In Time],[Out Time],HOUR))
var _b = SUMMARIZE(_a,'Table'[Employee ID],"Hours worked",SUMX(FILTER(_a,[Employee ID]=EARLIER('Table'[Employee ID])),[Hours Worked]))
return COUNTX(FILTER(_b,[Hours worked]<>0),[Employee ID])
Final output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @tejutulasi67 ,
Based on your description, I have created a simple sample:
Please try:
Status =
var _a = SUMMARIZE('Table',[Employee ID],[In Time],[Out Time],"Hours Worked",DATEDIFF([In Time],[Out Time],HOUR))
return IF(SUMX(_a,[Hours Worked])<>0,"Present","Absent")
Count of Absent =
var _a = SUMMARIZE('Table',[Employee ID],[In Time],[Out Time],"Hours Worked",DATEDIFF([In Time],[Out Time],HOUR))
var _b = SUMMARIZE(_a,'Table'[Employee ID],"Hours worked",SUMX(FILTER(_a,[Employee ID]=EARLIER('Table'[Employee ID])),[Hours Worked]))
return COUNTX(FILTER(_b,[Hours worked]=0),[Employee ID])
Count of Present =
var _a = SUMMARIZE('Table',[Employee ID],[In Time],[Out Time],"Hours Worked",DATEDIFF([In Time],[Out Time],HOUR))
var _b = SUMMARIZE(_a,'Table'[Employee ID],"Hours worked",SUMX(FILTER(_a,[Employee ID]=EARLIER('Table'[Employee ID])),[Hours Worked]))
return COUNTX(FILTER(_b,[Hours worked]<>0),[Employee ID])
Final output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@tejutulasi67 , what should it be counted when both are there? present and absent ?
I have punch in time out time and no of hours worked fields also as shown below. if the person has working hours then present should come otherwise absent.
thank you.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
87 | |
85 | |
70 | |
51 |
User | Count |
---|---|
205 | |
153 | |
97 | |
79 | |
69 |