Skip to main content

Hi all,

 

I'm pretty sure I got fairly close with this, but now I'm too deep into the problem and can't see the wood for the trees.

 

The dataset is Covid-19, and I'm looking, for example, at the number of cases per country.

I would like to have a line for each country, with the line starting at a common point, such as when a country reaches 500 cases.

 

I have manually created it and adjusted the dates on the Tab 'Over 500 cases'.

But I would like to be able to adjust the number, and for new countries to automatically work.

 

I had thought I would be able to use a level of detail to find the minimum date when a value was first reached,

calculate the difference between that date and the latest date in the data.

 

I ran into issues as (maybe) the USA numbers (and some others) are made up of multiple states, whereas another country would just be a single line.

 

You'll see some attempts to do it on the following fields:

  • Over Case Limit
  • Over X Cases
  • Min Country
  • Different in Dates
  • Baselined Dates

 

Workbook on Tableau Public here:

Tableau Public

 

eg:

 

Help Automatically Adjusting Dates to Match

8 answers
  1. Mar 22, 2020, 3:11 AM

    Hi Jean,

     

    You can use one of table calculation help function index() to achieve the common baseline comparison.  An example will be on Tableau blog Top 10 Tableau table calculations | Tableau Software case 2.

     

    Back to your case, here is the solution.

    Step 1. Create one calculated field [# of days Since 500 cases] whose formula is simple as INDEX().

    Step 2. Drag and Drop [Date] into details and choose date value day as details, also change the mark type to Line chart.

    Step 3. Replace [Manually Adjusted Date] on columns with [# of days Since 500 cases], configure Table Calculation direction as Computing Using > Date.

     

    you can find the solution in attachment.

    Hi Jean, You can use one of table calculation help function index() to achieve the common baseline comparison.

    Cheers

     

    Jimmy Zhang

0/9000