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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
JamesLindsay101
Frequent Visitor

Help Required: on conditional counts and Staff Sickness Ratio (Syntax and Dax help)

Hi, my request is similar to the one hyperlinked here, however slightly different.

 

I am looking to form a column of counts in my Date Dimensions table from a table of absences (this table includes a list of absence episodes with columns that include a start date and an end date, and other contextual info that isn't relevant here) how many of these absences include a date from my Date Dimension/bridger table.

 

My thinking is that if I'm able to count how many times each date in the date column my date dimension table is in between each of the absence start date and end dates, I can work out how many days are being taken off across a specific period and therefore put together a staff sickness ratio measure.

 

Trying the above hyperlinked solution will only give me if the date dimensions are appearing inbetween the start date and end date, however I'd almost like the reverse of this.

 

This is generally what I'm trying to do (What I'm aiming towards in DAX):

Total Absences by Day =
CALCULATE(
SUMX(Absences,
IF('Date Dimension'[Date]>=Absences[Absence Start Date]&&'Date Dimension'[Date]<=Absences[Absence End Date])))

 

I think I'm mixing up measure calculations and column calculations also, Any ideas?

 
4 REPLIES 4
v-kkf-msft
Community Support
Community Support

Hi @JamesLindsay101 ,

 

Please try the following measure:

 

Total Absences by Day = 
SUMX (
    SUMMARIZE (
        'Date Dimension',
        'Date Dimension'[Date],
        "_count",
            CALCULATE (
                COUNTROWS ( Absences ),
                FILTER (
                    Absences,
                    Absences[Absence Start Date] <= MAX ( 'Date Dimension'[Date] )
                        && Absences[Absence End Date] >= MAX ( 'Date Dimension'[Date] )
                )
            )
    ),
    [_count]
)

vkkfmsft_0-1653289255312.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Thanks you, one issue I'm having with this is when I feed this into my sickness ratio calculation and I filter the page by department (to get a departmental view), the department filter seems to be messing this up. I've got a date bridge table (similar to yours above) and a department bridge table. Do you have any possible ideas on how I could make this work?

 

I think the issue is that the total absences by day column is too disconnected from the departmental relationship(s) in my relationships network

Hi @JamesLindsay101 ,

 

In my model, the Date Dimension table is a separate table and no relationship is established between it and Absences table. So could you please share your model and sample data?

 

vkkfmsft_0-1653464241230.png

 

Best Regards,
Winniz

Mine currently uses an inactive relationship, is this the same as when there is no relationship?

Please see below the relationship screenshot (I can't share the data as it's sensitive information), note I've made the sub-division (department) dimension bridge table active as it wasn't interacting with the filters on the page when inactive.

The Sickness Ratio measure is made up of the measure in this forum and then 2 headcount measures in the employee listing table. hope this helps

Power BI Relationship Picture.JPG

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.