Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Remove weekends from date calc

What do I need to modify to remove weekends from these?

Date Diff in Days =
IF (
    ISBLANK ( 'Burndown'[Date Previous] ),
    1,
    DATEDIFF (
        'Burndown'[Date Previous],
        'Burndown'[DateValue],
        DAY
    )
)


State Time in Days =
CALCULATE (
    SUM ( 'Burndown'[Date Diff in Days] ),
    ALLEXCEPT ( 'Burndown', 'Burndown'[WorkItemId] ),
    'Burndown'[DateValue] <= EARLIER ( 'Burndown'[DateValue] ),
    'Burndown'[State] = EARLIER ( 'Burndown'[State] )
) + 0
  • Hi Anonymous ,

     

    Please try:

    Date Diff in Days =
    IF (
        ISBLANK ( 'Burndown'[Date Previous] )
            || WEEKDAY ( 'Burndown'[Date Previous], 2 ) >= 6,
        1,
        DATEDIFF ( 'Burndown'[Date Previous], 'Burndown'[DateValue], DAY )
    )

    If that don't work, please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.

     

    Refer to:

    How to provide sample data in the Power BI Forum

    How to Get Your Question Answered Quickly

     

    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.

1 Reply

  • Hi Anonymous ,

     

    Please try:

    Date Diff in Days =
    IF (
        ISBLANK ( 'Burndown'[Date Previous] )
            || WEEKDAY ( 'Burndown'[Date Previous], 2 ) >= 6,
        1,
        DATEDIFF ( 'Burndown'[Date Previous], 'Burndown'[DateValue], DAY )
    )

    If that don't work, please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.

     

    Refer to:

    How to provide sample data in the Power BI Forum

    How to Get Your Question Answered Quickly

     

    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.