6 Replies Latest reply on Feb 5, 2014 5:41 AM by Maarten Schuit

    Make calculated field values dependent of values in checkbox

    Siebe Bosch

      Hi all,

       

      I'm currently working on a map with points. These points get values based on a selection by the user. (The user selects a return period and a scenario, which filters the results).

       

      Schermafbeelding 2014-01-22 om 16.07.58.png

       

      Now I want to add a functionality: let the user check some checkboxes that represent certain regions. For each selected region, a value of 0.5 has to be added to the corresponding points on the map.

       

      Each point in the Excel-source already has the name of its region in an extra column:

       

      ID, Lat, Lon, Scenario, ReturnPeriod, Value, Region

       

      Any ideas how to do this?

       

      1 - create a parameter?

      2 - create a calculated field?

       

      If so: how do I make the adjustments so that the 0.5 is only added to those points that lie within the checked region?

       

      Thanks for your suggestions

      Siebe

        • 1. Re: Make calculated field values dependent of values in checkbox
          Tracy Rodgers

          Hi Siebe,

           

          I'm not sure that I understand exactly what you're trying to do. Would you be able to post a sample workbook with specific details for the desired ultimate outcome?

           

          -Tracy

          • 2. Re: Make calculated field values dependent of values in checkbox
            Wendy Zhou

            I think you need both Parameter and Calculated field.

            correct me if I misunderstood you,

            set parameter, value as 0.5 etc, display as name of region that end user could understand.

            from there, create calculated field, assign that parameter in formula that you want to adjustments.

             

            hard to picturing without actual workbook.

            • 3. Re: Make calculated field values dependent of values in checkbox
              Siebe Bosch

              Hi guys,

               

              I do realize it was a bit unclear. Here's a viz. What I want to happen is the following:

               

              If someone clicks "Tolbert" then the map values of nodes in the region Tolbert should be raised by 50 cm.

              Same for Wolddiep. If someone clicks that, then the map values of nodes in the region Wolddiep should be raised by 0.5m

               

              (Oh by the way: if you don't see the Elevate Dikes checkboxes that's because the thumbnail could not be refreshed. If you actually open the viz, you'll see it.)

               

              http://public.tableausoftware.com/static/images/Vi/Visualisatie2/Waakhoogte/1.png

              • 4. Re: Make calculated field values dependent of values in checkbox
                Matt Lutton

                Not sure I understand either, but you can write something like:

                 

                CASE attr([Kadeverhoging$_Kade])

                when "Tolbert" then avg([Waakhoogte (cm)])+50

                when "Wolddiep" then avg([Waakhoogte (cm)])+500

                else avg([Waakhoogte (cm)])

                end

                 

                And use that new field on the Label shelf.  But again, I'm not clear on what you are hoping to do and your annotations are making it more difficult for me to understand what you're hoping to accomplish.

                • 5. Re: Make calculated field values dependent of values in checkbox
                  Siebe Bosch

                  Hi Matt, I appreciate your help, but hat's not what I meant.

                   

                  If Wolddiep.checked then avg(Waakhoogte) FOR REGION WOLDDIEP + 50 cm.

                  If Tolbert.checked then avg(Waakhoogte) FOR REGION TOLBERT + 50 cm.

                   

                  So multiple checkboxes must be able to be active simultaneously and ONLY the nodes in the corresponding regions should be raised by 50cm....

                   

                  The whole problem so far is that I've only been able to raise ALL nodes by 50 cm, but not only subselections....

                  • 6. Re: Make calculated field values dependent of values in checkbox
                    Maarten Schuit

                    The main issue seems to be that there is no multiselect paramter, however, this should fix it (with a bit of work)

                     

                    Create a parameter for each region (string) with the region name as value (display as "True") and 0 (display as "False")

                     

                    Then create a calculated field with:

                    avg(waakhoogte) +

                    if([Parameter 1] = [Region]) then 50 else 0 end +

                    if([Parameter 2] = [Region]) then 50 else 0 end +

                    etc.

                     

                    (might want to divide the 50 by number of records)

                     

                    Result: You get a lot of parameters which you can set to true or false, if they are true, the calculated field compares the value with the region name, if it's the same, it will add the specified value to that region alone.

                     

                    *Hope you don't have many regions and that you don't want to program interaction between regions