Répondre à: Dates et jours ouvrables

  • DavidZed

    Membre
    27 mars 2023 à 16h43

    Bonjour,

    Pour les jours ouvrables, tu peux utiliser la formule ci-après (Dans l’exemple on calcule le nombre de jours entre deux date pickers, qui ne sont ni des samedi, ni des dimanches ) :

    With(n    {n        // Table of all dates between start and end daten        DateRange: ForAll(n            Sequence(DatePickerFin.SelectedDate - DatePickerDebut.SelectedDate + 1),n            DatePickerDebut.SelectedDate + Value - 1n        )n    },n    If(n        And(n            IsBlank(DatePickerDebut.SelectedDate),n            IsBlank(DatePickerFin.SelectedDate)n        ),n        // show nothing if any date pickers are blankn        0,n        // Count if Week day is from Monday to Fridayn        CountIf(n            DateRange,n            Weekday(Value,11) < 6n        )n    )n)

    Pour les jours fériés, le plus simple est de créer une liste sharepoint avec deux colonnes : ‘Titre’ et ‘Date’, et d’ajouter une condition dans le countIf à la fin :

    With(n    {n        // Table of all dates between start and end daten        DateRange: ForAll(n            Sequence(DatePickerFin.SelectedDate - DatePickerDebut.SelectedDate + 1),n            DatePickerDebut.SelectedDate + Value - 1n        )n    },n    If(n        And(n            IsBlank(DatePickerDebut.SelectedDate),n            IsBlank(DatePickerFin.SelectedDate)n        ),n        // show nothing if any date pickers are blankn        0,n        // Count if Week day is from Monday to Fridayn        CountIf(n            DateRange,n            Weekday(Value,11) < 6n            Not(Value in 'Liste Jours Fériés'.Date)n        )n    )n)

    CommentID=naN6Vm7ZLrwpwtR, PostID=JOkQBIMfO7SBtxA