2 Replies Latest reply on Jan 28, 2014 11:02 PM by brian.kim.0

    How do I count a measure twice?

    brian.kim.0

      I have data that looks like the following:

       

       

      Win

      1

      Margin

      24

      111
      0-5
      0-10
      10
      1-6
      10
      115
      1-9
      0-11
      1-1
      1-6
      0-1
      0-4
      16

       

      I have it set up in a bar chart right now with the Margin in the Columns and CNT(Win) as the rows. Assuming that Tableau is counting when Win=1, how do I add Win again to count when Win=0 (which is a loss)? And then how do I have the count of those losses appear next to corresponding wins with the same margin?

        • 1. Re: How do I count a measure twice?
          Ramon Martinez

          Hi Brian,

           

          I'm understanding that you need to create a bar chart representing the sum of margin per win, where Win is a dimension and Margin is a measure.

           

          To reach that I first drag Win to Dimensions, the I drag margin to Columns shelf and Win to Rows shelf. You will see that an horizontal bar will show margin level (as a sum or margin) by Win, where win has only two values 0 and 1.

           

          Now, as you are interested in add the number of items (number of records in your data source) per Win, I just drag the special measure Number of Records to label on Marks card. As a result the number of lost (0s) and win (1s) are display on every bar.

           

          I also added the dimension Win to Color shelf in Marks card

           

          Take a look a the attached workbook created with your sample data set to see if it solves the requirement you've described.

           

          I hope this helps

           

          Best

          Ramon

          • 2. Re: How do I count a measure twice?
            brian.kim.0

            Hi Ramon,

             

            Thanks for the help. It was that last step of adding Win again to the color shelf that I needed.