KNOWLEDGE BASE

## How To Plot All Weeks On An Axis Even When Data Is Available For First Few Weeks

Published: 13 May 2021
Last Modified Date: 14 May 2021

### Question

How to plot all weeks on an axis even when data is available for first few weeks. Example: Plotting Week 1 to Week 5 on an axis when only week 1 data is available

### Environment

• Tableau Desktop

### Answer

1. Create a calculation called Week-min:

{ FIXED MONTH([Date]):MIN(DATEPART('week',[Date]))}

2. Create another calculation called Weekly:

CASE DATEPART('week',[Date]) WHEN [Week-min] THEN "Week 1" WHEN [Week-min]+1 THEN "Week 2" WHEN [Week-min]+2 THEN "Week 3" WHEN [Week-min]+3 THEN "Week 4" WHEN [Week-min]+4 THEN "Week 5" WHEN [Week-min]+5 THEN "Week 6" END

3. In another data source like Excel create a sheet with Data as below

4. Add this as a new data source
5. Create a blend relationship on Week field and Weekly calculation

6. Drag Week from the new data source so that this is primary data source and the value from the original data source

Did this article resolve the issue?