Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

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 ?

 

  • Anonymous's avatar
    Anonymous
    7 years ago

    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

4 Replies