3 Replies Latest reply on Dec 14, 2012 4:25 PM by Catherine Rivier

    Display custom marks based on values?

    Brett Trani

      Hello,

       

      I am making a line chart that displays overall rates, calculated by matching counts up with population data. So for a given town with a population of 10,000 people, 100 people may have been arrested, giving me the arrest rate. What I would like to do is place a special mark on a line graph when counts are less than 10 people, indicating that that data point has been suppressed (but is not missing). My data is structured so that null values are written when data are missing and the line graph draws correctly, but I haven't been able to figure out how to display a custom mark based on the count. I can easily code counts less than 10 to 0s, but to the end user they would think that would be a 0 instead of suppressed.

       

      Any advice or tips would be helpful, and I'd be happy to post more info if needed.

       

      Thanks!

        • 1. Re: Display custom marks based on values?
          Catherine Rivier

          Hi,

          So I'm not entirely sure I know exactly what you want to see, but I'll throw some ideas out there to see if they'll help!

           

          In your line graph, is the repressed data showing up at all as a point?  It sounds like it's not, so I'm not sure where the description would go.  But if it is, you can make a calculated field called "Chart Label" that is something like:

               IF [Suppression Criteria]="Yes" then "Data has been suppressed"

               END

          This will give null values to any data points that are valid, but will label just the ones that are.  You can move this to the Label field or any other field you want.

           

          Another potential option is listing the suppressed values on a different visualization, and putting the two side by side on a dashboard.  By this method, you could say as much as you wanted about the suppressed data, without influencing the original view.

           

          Unfortunately, it's a little difficult for me to really know what would work in your situation because I'm not entirely sure of your setup.  Is it possible for you to set up a sample data set and post it?

          • 2. Re: Display custom marks based on values?
            Brett Trani

            Hi Catherine,

             

            Even with my poor description you were able to hit the nail on the head, this is exactly what I was looking for! Through that calculated field is it possible to specify shapes or other characteristics as well? I've only used the calculated values to do numeric manipulations, but that would be a huge bonus to be able to control other properties as well.

             

            Thanks so much for your help!

            • 3. Re: Display custom marks based on values?
              Catherine Rivier

              Great, I'm really glad this helped

               

              So adding shapes/colors to label these points is fun - this starts to get into cool Tableau features.  Basically, I'm going to put a separate point graph over the existing line graph, which I can color and label however I want.

               

              Here's a sample visualization where I added the label and a colored shape for January and April sales points.  To do this, I created two new fields.  The first has the same numeric field as the current Y-axis for only the points I want, field "_SalesLabel":

                   IF DATEPART('month',[Order Date])=1 THEN [Sales]

                   ELSEIF DATEPART('month',[Order Date])=4 THEN [Sales]

                   END

              The second does exactly the same, but gives it a text field, field "_SalesShape":

                   IF DATEPART('month',[Order Date])=1 THEN 'January'

                   ELSEIF DATEPART('month',[Order Date])=4 THEN 'April'

                   END

               

              I then use the _SalesLabel field - which has the Sales data for only January and April, and bring it onto my secondary axis.  Right-click on the axis and click "Synchronize Axis".  Then, to make one a line graph and the other points, under Marks drop down menu, select "Multiple Mark Types".  Scroll to your secondary axis variable and pull down the graph type to Shape.

               

              Now you can make your shapes and colors however you want them to be for this group.  I used the second new calculated field _SalesShape to set those colors and shapes how I want.

               

              Let me know if you have any problems with this, but hopefully this opens up some possibilities for your viz!