3 Replies Latest reply on Mar 15, 2016 11:59 AM by pooja.gandhi

    Charting by measure value counts

    Karen Massey

      I have a measure Overall, that has four possible values: 1, 2, 3, 4 or Green, Yellow, Red, and Null.

      I want to create a chart that shows 4 lines over a 12 month range, where the lines are the count of Green, Yellow, Red, and Null that occur each month.  Using Excel, I created a pivot chart to count the occurrences of each value per month, and a chart from the pivot table:

      Excel chart of counts.PNG

      In Tableau, I created calculated fields to count the occurrences of Red, Yellow, and Green, but when charting it, I'm able to create a dual axis chart with two of the counts but not include the third.

      Count measure values mockup.png

      I feel like I need a calculated field that contains three values, count of red, count of yellow, count of green that I can chart across the months with the calculated field on color but can't figure that out.  Any help is much appreciated!  Sample file is attached, and the excel file shows a tab for data and a tab with the pivot table and chart.

        • 1. Re: Charting by measure value counts

          Hi Karen!


          You can drag 'overall' to dimensions then place the pills as shown and there you have it:


          1 of 1 people found this helpful
          • 2. Re: Charting by measure value counts
            Karen Massey

            Thank you!  I knew it must be something simple but I would never have thought to move a Measure to a Dimension.  If you know of any blog or training that covers the theory behind this or cases where such a move would be useful, that would be most helpful.  In this case, it seems that converting the measure to a dimension converts the measure value set to "categories" that can then be counted - am I getting this right?  Looking for an underlying business rule so I can figure out things in the future...

            • 3. Re: Charting by measure value counts



              Glad you found it useful. In this case it was trivial to just move it because based on your snapshot above:



              the 1,2,3 is what you wanted to count the number of records for when grouped by date. Because it is a number, Tableau automatically threw it in the measures pane which should then be manually moved to dimension because that is what you wanted in this case. The way I usually think about while solving a problem in Tableau is by 'grouping' and that would mostly mean dimensions. Hence, my instant thought was to move it. Leaving it in measures in this case would give incorrect aggregate results. There are a ton of resources out there from articles, blogs to videos and not to forget this community forum full of talented folks.


              Hope this helps!



              1 of 1 people found this helpful