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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Connoza
Frequent Visitor

Calculated table - 10 absence occurred within 6 weeks

Any help would be appreciated.

How would I create a column that checks against ID and provides yes for 10 absence occurrences within 6 weeks.

 

When it hits 10 occurrences it provides yes. If the absence carries on it does not count unless it is 10 more within 6 week.

 

F771E7EF-FF1E-4D06-AC4D-65E257A4F615.jpeg

 

 

1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @Connoza ,

 

Please try:

Column = 
var _a = CALCULATE(COUNT('Table'[Employee]),FILTER('Table',[Employee]=EARLIER('Table'[Employee])&&[Absence]>=EARLIER('Table'[Absence])-42&&[Absence]<EARLIER('Table'[Absence].[Date])))
var _b = MOD(_a,10)
return IF(_b=0&&_a<>BLANK(),"Yes","No")

Final output:

vjianbolimsft_0-1669859326091.png

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.

View solution in original post

3 REPLIES 3
v-jianboli-msft
Community Support
Community Support

Hi @Connoza ,

 

Column = 
var _a = CALCULATE(COUNT('Table'[Employee]),FILTER('Table',[Employee]=EARLIER('Table'[Employee])&&[Absence]>=EARLIER('Table'[Absence])-42&&[Absence]<EARLIER('Table'[Absence].[Date])))
var _b = MOD(_a,10)
return IF(_b=0&&_a<>BLANK(),"Yes","No")

the var _a is to calculate the count of current employee in 6 weeks (6*7=42 days).

the var _b is to returns the remainder after var _a is divided by 10

If var _b is zero and var _a is not a blank value (if var _a is a blank value, then var _b may also be 0, so it should be excluded), it means that 10 absence occurred within 6 weeks. In this condition, return "yes", else "no".

 

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.

v-jianboli-msft
Community Support
Community Support

Hi @Connoza ,

 

Please try:

Column = 
var _a = CALCULATE(COUNT('Table'[Employee]),FILTER('Table',[Employee]=EARLIER('Table'[Employee])&&[Absence]>=EARLIER('Table'[Absence])-42&&[Absence]<EARLIER('Table'[Absence].[Date])))
var _b = MOD(_a,10)
return IF(_b=0&&_a<>BLANK(),"Yes","No")

Final output:

vjianbolimsft_0-1669859326091.png

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.

Really appreciate your help with this.

 

 Would you be willing to breakdown the example, explain your thought process and what the dax is doing?

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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