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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Calculation between Start and End Date

Hi

 

I have one table named "AbsenceDetailsFact" with columns named date_start, date_end, absence_days. following snap is the data from the table (sample data for one employee). I want to map fact table "AbsenceDetailsFact" with Date dimension table and want to calculate the number of absent employees for a month, year, quarter (user select from slicer). If you look at the row heighlighted, row is showing 4 absence_days because 2 holidays come in between that date range. How to handle this requirement ?

 

DateLeaves.GIF

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

Yes, it is possible. I modify my formula to add two variable to get current start,end date for calculation.

Workday =
VAR currStart =
    MIN ( Table[Start] )
VAR currEnd =
    MAX ( Table[End] )
RETURN
    COUNTROWS (
        FILTER ( CALENDAR ( currStart, currEnd ), WEEKDAY ( [Date], 2 ) < 6 )
    )

Regards,

Xiapxin Sheng

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

HI @Anonymous ,

You can use following calculated column formula to manually calculate workdays:

Workday =
COUNTROWS ( FILTER ( CALENDAR ( [Start], [End] ), WEEKDAY ( [Date], 2 ) < 6 ) )

Regards,
Xiaoxin Sheng

Anonymous
Not applicable

Can we create measure instead of column that can accept Start and End date ?

Anonymous
Not applicable

Hi @Anonymous ,

Yes, it is possible. I modify my formula to add two variable to get current start,end date for calculation.

Workday =
VAR currStart =
    MIN ( Table[Start] )
VAR currEnd =
    MAX ( Table[End] )
RETURN
    COUNTROWS (
        FILTER ( CALENDAR ( currStart, currEnd ), WEEKDAY ( [Date], 2 ) < 6 )
    )

Regards,

Xiapxin Sheng

Greg_Deckler
Community Champion
Community Champion


Take a look at these two Quick Measures as I think you want something like them.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Open-Tickets/m-p/409364
https://community.powerbi.com/t5/Quick-Measures-Gallery/Periodic-Billing/m-p/409365



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors