7 Replies Latest reply on Jul 8, 2018 11:18 AM by Ken Flerlage

    Parameter control to get Percent of total using a dimension and measure

    Jeff Grant

      On Sheet 9 -

      Instead of 13 views of the map, I'd like one map based on the parameter selected that shows the details in all 13 maps. So if i select Arson, i just see the arson map with the color scheme darker for the higher percentages. Wracking my brain and I am fairly new to Tableau.

      I know its a simple calculated field just not sure how.

       

      Appreciate the help.

       

      Thanks

        • 1. Re: Parameter control to get Percent of total using a dimension and measure
          Ken Flerlage

          If I understand you correctly, you don't need a parameter or a calculated field. You just need to remove Stat Cause Descr from the rows shelf, then add it to the filters area. Right-click on the pill then select "Show Filter". On the filter that appears, click the menu and change it to a "single value dropdown" menu. Also, click the menu, go to "Customize" then deselect the "Show "All" Value" option. This will give you a dropdown that allows you to select one and only one statistic.

           

          You'll see that you now have an error on the SUM(Number of Records) pill defining your color.

           

           

          So, remove that pill (delete it).

          Then change the existing SUM(Number of Records) pill to define the color (just drag it up to the Color card).

           

           

          I believe that should give you what you're looking for. See attached workbook.

           

          If this resolves your question, then please mark this answer as the "correct answer." This will help others with similar problems in the future. If it does not resolve your question, then please let us know how else we can help. Thanks!

          • 2. Re: Parameter control to get Percent of total using a dimension and measure
            Jeff Grant

            Ken - thanks for the quick response. I'm new at this so probably not clear in my question.

             

            What i would like to see is for example:

             

            If I select Arson, i get a one map of the states with color range, with Arson as a % of total fires/records not just Arson records. So i can see which states have a greater incident of Arson or any Stat Cause Descr selected. It does this on all of the maps below, I'd like to see it one one map just trying to figure it out.

             

            I have attached a screen grab

             

            Thanks Again for your help,

            Jeff

             

            Screen Shot 2018-07-06 at 5.27.54 PM.png

            • 3. Re: Parameter control to get Percent of total using a dimension and measure
              Ken Flerlage

              OK, I think I understand. You should be able to use a LOD to do this. Try changing your % of Fires by Cause calculated field to the following:

               

              SUM([Number of Records])/SUM({FIXED : SUM([Number of Records])})

               

              This will give you the % of fires for the given type, compared to all fires in the entire US, regardless of type. If you want that to give you the % of fires for that specific state, then use the following:

               

              SUM([Number of Records])/SUM({FIXED [State]: SUM([Number of Records])})

               

              Then drag that to the Color card.

               

               

              A couple other things you may want to do:

               

              • Add filters to context - you may wish to add the State (group) filter to context (right-click and choose "add to context"). This will make sure that the filter is applied before the LOD is executed. You don't want to add the Stat Cause Descr field to context though.
              • Change the color range - The color range will work dynamically so 5% when on type if selected may look the same color as 20% for another type of fire. You may want to fix the start and end of the range in order to make this more consistent.

               

              See attached workbook. Hope that helps!

              • 4. Re: Parameter control to get Percent of total using a dimension and measure
                Jeff Grant

                Thanks again for looking into this question. If you go back to the example above (the one showing 3 maps and AL arson at 32.79% -- That 32.79 is the total percentage of Arson for the total fires in Alabama not the MAP.

                 

                I am trying to get a map, that when i select Stat Cause Descr it will fill in the map with color based on each states % of total. Those three maps are doing what i need i just want to get one map based on the selection/parameter chosen.

                 

                Best,

                Jeff

                • 5. Re: Parameter control to get Percent of total using a dimension and measure
                  Ken Flerlage

                  In that case, I think you just need to change the % of Fires by Cause calculated field to:

                   

                  SUM([Number of Records])/SUM({FIXED [State] : SUM([Number of Records])})

                   

                  That should do it. See the attached workbook.

                   

                  • 6. Re: Parameter control to get Percent of total using a dimension and measure
                    Jeff Grant

                    Ken - thanks so much for your help. That solution is exactly what i was looking for.

                     

                    Curious - when I added the steps to my workbook, i had to change the '% of Fires by Cause' Default Properties > Number Format to Percentage in order to get the legend to match yours (first replication in my workbook had the decimal place 2 places to the right i.e. 0.01152 vs 1.52% with the change). I noticed in your workbook the default was Automatic.

                     

                    Was there something i missed or just quirk in Tableau?

                     

                    Again thanks for your assistance.

                     

                    Jeff

                    • 7. Re: Parameter control to get Percent of total using a dimension and measure
                      Ken Flerlage

                      I think I must have just changed the formatting on the pills rather than the field's default.