It'd be perfect if I can name it with the number for week for example:
day -> week
0 -> 1
7 -> 2
14 -> 3
Is this possible?
As usual, there are more than one way to do what you want.
David was using the "Create Bins" function in Tableau. You can assign an alias for each value within the [Day count (bin)] field. However, you'd have to do this manually for every new tier in the bin.
I prefer to just build calculated fields to do all my grouping and binning.
You can be as tricky as you want to be with a calculated field.
Option A is to statically define your buckets and your outcome with an IF statement--basically identical to the Create Bins option. But any [Day count] values you don't account for in the formula will result in NULL in this grouping calculation.
Option B is to use the MODULO function ([A]%[B] = the integer remainder of A divided by B) to create your buckets AND name them as you desire.
//IF [Day count] < 7 THEN 1
//ELSEIF [Day count] < 14 THEN 2
//ELSEIF [Day count] < 21 THEN 3
//ELSEIF [Day count] < 28 THEN 4
//but you have to keep adding the next age bucket...
//so use MODULO function...
//days divisible by 7
IF [Day count]%7 = 0 THEN ([Day count] / 7)+1
//days not divisible by 7
ELSE ((7-([Day count]%7)+[Day count])-7)/7+1