2 Replies Latest reply on Nov 5, 2018 5:25 AM by Nagendra Babu

# Help with the Date calculation(Week Number and Number of weeks)

Hi All,

i have Week start date and end date like this and i want to create a parameter by using start date and end date. calculation

Period Start date  Period end date    Week Number

16-Dec-2017       22-Dec-2017           W1

23-Dec-2017       29-Dec-2017          W2

31-Dec-2017       5-Jan-2018            W3

6-Jan-2018         12-Jan-2018          W4

13-Jan-2018       19-Jan-2018          W5

W6

20-Jan-2018      26-Jan-2018          W7

27-Jan-2018      2-Feb-2018            W8

3-Feb-2018       9-Feb-2018             W9

10-Feb-2018     16-Feb-2018           W10

Month    Period Start Date      Period end date

Jan               16-Dec-2017       19-Jan-2018

Feb                20-Jan-2018        16-Feb-2018

Period End Date    Weeks Per Month

11-Dec-15

15-Jan-16                   5

12-Feb-16                  4

11-Mar-16                  4

Here i want to calculate no of weeks in the current period and current week number by using start date and end date selection in Parameter.

NOTE: weeks should be in 1-6days

Number of weeks in the current month and Current week number.

Please help me to get solution.

Regards,

Babu

• ###### 1. Re: Week Number and no of weeks in the current month

what do you mean by weeks should be in 1-6 days that means you don't want to calculate sunday or saturday in this case you need to use datediff function with combination of another function. DATEDIFF('week',[Opened],TODAY()) -

`- DATEDIFF('Sunday',[Opened],TODAY()) `

with this all Sundays will go from your logic... so that you will get exact number of days... if you want to remove saturdays also then use one more minus and add Saturday datediff function same like sunday... good luck

• ###### 2. Re: Help with the Date calculation(Week Number and Number of weeks)

Thanks Suresh,

Here i'm not Pulling data into tableau.

I want to create a calculation by using  parameter.

In this parameter having start date and end date.

By using above parameter i want to calculate Number of weeks in the month and Week number.

Regards,

Babu