Hello Phl Phl,
Based on your sample dataset, I have created the ff. solution:
1. Create the ff. calculated fields for flagging a number from 1 to N if there is actual CP sales / CPT sales for that period:
2. Once done, I created the ff. to have one single calculated field flagging the period for both CPT sales and CP sales. This is working on the assumption that days with CP Sales and days with CPT sales WILL NEVER OVERLAP.
It will look something like below if you have a crosstab view:
3. Once done, we create another calc field called Filter for Period. We need this to make it dynamic everytime the period is extended for either of the two measures.
4. Then, we build the final view below:
- Filter for Period - dragged as a filter and computed using table (across) or datetrunc
- Final Period is in the columns and computed using table (across) or datetrunc
- The two measure values are on the rows
Attaching as well the updated file - which was done in Tableau 10.3
Comparing Date Range v2.twbx 112.1 KB
Hello Phl Phl,
It's because there are some gaps in the data due to how we return the final period. To address it.
1. Right click anywhere on the chart > Format.
2. Then, in the left-hand window, click on fields > Select CP Sales first and then do it for CPT Sales after.
3. Then go to Pane. At the bottom, there is a section called "Special Values (eg. NULL)".
Go to Marks and then select Hide (Connect Lines).
4. It will then connect the dots regardless of the NULLs in the CP sales
Then, you have to do the same for CPT Sales.