4 Replies Latest reply on Jan 23, 2014 1:13 PM by Prachi Priya

    Switching between two measures on one map

    Prachi Priya

      I have created a map that shows total members per company/group on a US map, based on what we choose from the quick filter. It works fine. I would now like to choose one measure on the map: either Ttl or ttl share. For that, I created a parameter that selects one of the two. Based on what I read on forums here,  I also created a field called: ‘choose parameter’ and put this code there:

      CASE [Placeholder 1 Selector]

      WHEN "Total " THEN [Ttl]

      WHEN " Share" THEN [ttl share]

      END

      But it doesn’t work. Could someone please help? would really appreciate it. I have attached the sheet here. Also, is there a better way of showing the  numbers on the map? I use basic’ Mark label’ but it doesn’t always work.

        • 1. Re: Switching between two measures on one map
          Joshua Milligan

          Prachi,

           

          In your calculation, you have a couple of spaces in the string (one after Total and another before Share).  That is preventing a match on the value selected in the parameter.

           

          It also looks like you are labeling the map with the [Ttl] field.  Try replacing that with your [Choose Parameter] calculated field and then you'll see a change when you change the parameter.

           

          Hopefully that helps!

           

          Regards,

          Joshua

           

          0.png

          • 2. Re: Switching between two measures on one map
            Prachi Priya

            Thanks so much for your reply Joshua, that worked. Now I can toggle between the two parameters. The only glitch is I see market share as a number with decimals(.4477). Is there a way I can show the market share as %? That's how I have it in the data.

            • 3. Re: Switching between two measures on one map
              Joshua Milligan

              Prachi,

               

              In Tableau, you can assign a single format to a given field.  There is no way to dynamically switch the formatting.

               

              I have seen the following as a workaround:

               

              Update your calculation so that one of the measures is negative.

               

              CASE [Placeholder 1 Selector]

              WHEN "Total " THEN [Ttl]

              WHEN " Share" THEN -[ttl share]

              END

               

              Then, you can right click the calculated field, select Default Properties --> Number Format and apply a custom format.  Here you'll give a custom format string and you have an option of defining different formats for positive versus negative.  So you could input a format string like:

              #,###;0%

               

              Where the positive number (Ttl) will be formatted like a whole number and the "negative" number will show as a percent (without a negative sign, because that would have been #,###;-0%).

               

              Regards,

              Joshua

              2 of 2 people found this helpful
              • 4. Re: Switching between two measures on one map
                Prachi Priya

                That was a brilliant workaround Joshua, it worked! Thanks so much!