Hello,
You can import this module https://marketplace.mendix.com/link/component/116770 and use WorkingDaysIncludingDates or WorkingDaysExcludingDates java action.
WorkingDaysIncludingDates:
Get working days (excluding Saturday and Sunday) using start date and end date (Start and End date will be included in the working days).
WorkingDaysExcludingDates:
Get working days (excluding Saturday and Sunday) using start date and end date (Start and End date will not be included in the working days).
Hope it helps!
You can use based on the start and end dates in the entity. Loop through each day excluding weekends, and display or store the working days as the duration.
You are welcome.