Forum Discussion

JoeJames's avatar
JoeJames
New Member
1 year ago
Solved

Help in creating a calculated column

Hi The table visualization below shows some of the fields that I have in my data table. Transmittal sent is a column coming from a table called TRN History  WF Completed Date is a column in the Do...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi JoeJames ,

     

    You can try formula like below to create calculated column:

    WorkdaysBetween = 
    VAR StartDate = 'Table'[StartDate]
    VAR EndDate = 'Table'[EndDate]
    VAR TotalDays = DATEDIFF(StartDate, EndDate, DAY)
    VAR Weekends = 
        COUNTROWS(
            FILTER(
                ADDCOLUMNS(
                    CALENDAR(StartDate, EndDate),
                    "DayOfWeek", WEEKDAY([Date], 2)
                ),
                [DayOfWeek] = 6 || [DayOfWeek] = 7
            )
        )
    RETURN
    TotalDays - Weekends

     

    Best Regards,
    Adamk Kong

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.