Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Ho do I calculate date plus days without weekends in Table Transformer SQL

I'm looking to have a table with one column of dates, another column of days and the 3rd column calculated by adding the two and excluding the weekends.   Say if date Jan 1 falls on a Monday and i need to add 8 days, the resulting 3rd column will be Jan 10 (Wed the following week).  I followed the following article but it is a straight days add.

https://community.atlassian.com/t5/Confluence-questions/Calculating-dates-from-a-start-date/qaq-p/930126

Thanks in advance for your help

1 answer

1 accepted

3 votes
Answer accepted
Katerina Kovriga _Stiltsoft_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Dec 22, 2020

Hi @Fulbert Lato ,

You may try the following SQL query:

Tue 2-1.pngSELECT *,
FORMATDATE(DATEADD(day,
T1.'Period' +
2 * FLOOR(T1.'Period' / 5) +
CASE
WHEN 'Start Date'::Date->getDay() = 0 THEN 1
WHEN 'Start Date'::Date->getDay() = 6 THEN 2
WHEN ('Start Date'::Date->getDay()) + T1.'Period' % 5 > 5 THEN 2
ELSE 0
END,
T1.'Start Date'))
AS 'End Date'
FROM T1

Tue 2-2.pngThe query counts the number of Saturdays and Sundays for your period plus checks if the Start Date belongs to the weekend and "extends" the period (i.e. moves the End Date further) for the calculated number of holidays.

That is brilliant!  Thank you!

arijit chatterjee
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
Nov 01, 2023

I am getting NAN.NAN.NAN as output now.. Date format is not working. please can you help!

Stiltsoft support
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Nov 01, 2023

Please refer to our support. Attach the Page Storage Format (upper right corner -> menu ... -> View Storage Format), so we'll be able to recreate exactly your source table and the Table Transformer macro settings. If you don't see this option, ask your Confluence administrator to do it for you.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events