5 Replies Latest reply on Jul 8, 2016 6:15 AM by Luciano Vasconcelos

    Color code date column based on today

    Mihai Adrian Negru

      Hello Tableau community,

       

      I am working a bit on a reporting system using tableau. I would like to color code the first column based on the reporting date.I know it could work on the last column, but how do I make it the first?

       

      The color coding should look this way:

      - between the current day and 10 days ago --> Green background

      - between the current day and 10 - 30 days ago --> Yellow background

      - between today and more than 30 days ago --> red background

       

      How can I achieve this?

       

      Color Code Month.png

        • 1. Re: Color code date column based on today
          Adam Wrona

          Hi Mihai,

           

          I am not sure if my solution will suit you, however I would do that playing in with the Dashboard view. Please find attached file.

          Whole idea relies on constructing the dashboard. You have 2 similar sheets - one with extended data and hidden Resolve date column, second with only ATTR for resolve date - colored and visible in last column.

          Hope that helps.

          Adam

          • 2. Re: Color code date column based on today
            Alastair Young

            Hi Mihai,

             

            From reviewing your workbook, the ideal scenario would be to have the Overall Status Name conditionally formatted like below. As your formatting is based on the Overall Status Name this would be more logical.

             

             

            Your request to conditionally format the first column makes it slightly more tricky. As you already know, the measures and colour formatting is normally assigned to the right columns as this is normally subject to a measure value and we are unable to conditionally format a dimension like so without some sort of workaround.

             

            We can however still achieve this by using calculated measures and multiple Marks altho this does have some limitations to the style and formatting of the worksheet.

             

            This produces something like this shown below.  I have attached it for your reference. I created a chart, with MDY Reporting Date in the rows, I then dropped Avg 1 on the columns twice and used the marks values to create a bar chart that we assign the colour formatting onto, and dropped the MDY(Reporting Date) in as text, fixing both axis and then dual axis these together gives you the conditionally formatted date. To added further columns we need to create measure columns and drop the necessary dimensions into the Marks card as text objects which you will see.

             

            This limits the ability for headers as I have removed the Axis headers.

             

            Feel free to break the workbook down and decipher what is best for you.

             

             

             

            Thanks

            Alastair

            1 of 1 people found this helpful
            • 3. Re: Color code date column based on today
              Ashish Chaudhari

              Hi Mihai,

               

              As far as I know you can color those headers dynamically. That's the reason you can see the separate part to the right.

               

              I don't think there is any way to color code first column using single sheet. All what you can do is refer to the screenshot below.

               

              I have added the Dates to the label section so we started getting dates there. Now you can see that we are able to get the whole background color-coded. If you put a dimension to the color (in this case Reporting date), you will get the separate color for each of the date but we need dates to be color coded as per the Overall status.

               

              Can't attach the workbook since you are using the older version of tableau.

               

              Thanks and Regards,

              Ashish Chaudhari

              • 4. Re: Color code date column based on today
                John Sobczak

                Is this what you are looking for?  I created this in 9.2 since I didn't have 9.1.

                 

                7-8-2016 7-21-02 AM.png

                1 of 1 people found this helpful
                • 5. Re: Color code date column based on today
                  Luciano Vasconcelos

                  Reporting Date is not a real Date field.

                  Is it possible bring a real date field?