cancel
Showing results for
Did you mean:
New Member

## 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.

1 ACCEPTED SOLUTION
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")``````

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.

3 REPLIES 3
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.

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")``````

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.

New Member

Really appreciate your help with this.

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

Announcements

#### 2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

#### Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

#### 2022 Monthly Feature Releases

We had a great 2022 with a ton of feature releases to help you drive a data culture.

Top Solution Authors
Top Kudoed Authors