6 Replies Latest reply on Oct 30, 2016 10:15 PM by Duong Vu

# How to adjust week number

Dear all

I have issue when I show week number .

as you know that Week 1 of 2016 is 01 ~ 02 Jan '16 . From 03 ~  is Week 2.

but in our company system count : from 03 ~ is week 1, show that week number in tableau is Week 40, but our company's system is 39.

So I want to change week number in tableau for same company's system.

Everybody help me , ^^

thank so much.

• ###### 1. Re: How to adjust week number

Hi Duong,

Do u have any week Start ? If yes, please try the below. Right on the Data Source and change them.

Else you need to edit your Week to show one week lesser. Like a calculated Field containing the below

if (DATEPART('week', [Date]) - 1) = 0 then

"Week  " + str(DATEPART('week', dateadd('week',-1,[Date])) )

else

"Week  " + str(DATEPART('week', [Date]) - 1)

end

2 of 2 people found this helpful
• ###### 2. Re: How to adjust week number

Dear Mr. Rasa

but i want change something :

if (DATEPART('week', [Date]) - 1) = 0 then      // if date is week 1 ( in tableau)

"Week  " + str(DATEPART('week', [Date]) )     // display Week 1

else                                                                   // if date is from week 2

"Week  " + str(DATEPART('week', [Date]) - 1)  // display week current -1.

end

so that Week 1 (display) = Week 1 & 2 ( in tableau)

How do u think ?

when i apply this, i see it is correct.

1 of 1 people found this helpful
• ###### 3. Re: How to adjust week number

Yeah Duong, I was planning the same to display week 1 & 2 as week 1. But just tried to show a week earlier.

If you want it this way, yes above formula is right.

• ###### 4. Re: How to adjust week number

Dear Mr. Rasa

now I have issue :

when we use table data , it is OK,

but I can't apply graph , tableau not support graph when u use time for this calculate.

I already try to change "week" calculate to date , but it can't.

Can u support me

• ###### 5. Re: How to adjust week number

Hi Duong,

Your formula takes Data part i.e week and makes it a String.

So you should not really change it to Date.

May I know what graph/chart you are trying ? Can you share a screenshot of the expected chart?

Can you share the Workbook in twbx file?(Sample or fake data is fine)

• ###### 6. Re: How to adjust week number

Dear Mr. Raza

sorry reply you later, because I can't upload any file to internet. (security of company)

but I already find 1 way is very easy.

no nee make calculate ...

now u make is normal, u bring dimensions [Date] into columns

after u double kick to dimensions [Date] in area columns.

it will display : DATERUNC('week',[Date]) , u revise like this : DATERUNC('week',[Date])-1

and result is correct & everything I normal , u no need do anymore .

How do u think ?

thank & best regard.