4 Replies Latest reply on Jun 13, 2017 12:12 PM by Marc-Anthony Di Biase

    Use Parameter Control to Change Chart Type

    Andrew Fuenmayor

      New user here.  I want my users to be able to change a given table between viewing the total number of students in a subgroup to viewing the percent of the total. For example

       

      I want the user to be able to switch from viewing the data like it is displayed on the left to how it is displayed on the right.  Having them both right next to each other like that works but I think it looks a bit busy.  How can I pull this off?  Im guessing some kind of calculated field which refers to the value of the parameter but I am having trouble getting it to work.  Any help would be appreciated.  Thanks.

        • 1. Re: Use Parameter Control to Change Chart Type
          Norbert Maijoor

          Hi Andrew,

           

          Find attached thread on this topic.

           

          Regards,

          Norbert

          • 2. Re: Use Parameter Control to Change Chart Type
            Marc-Anthony Di Biase

            This can be done with dash boarding, by using the parameter within a calculated field that would show the desired graph depending on the user's selection.

             

            Set up a parameter that will hold the different views, in this case % of total records and number of records.

             

            Create a calculated field that checks the parameter value and displays the dimensions accordingly

            IF([parameter name] = '% of total records' THEN [Percent of total records] ELSEIF [parameter name] = 'Number of Records' THEN [Number of Records] END

             

            Create two separate sheets for each graph, then place the two graphs side by side within your dashboard, each with your calculated field in your column field. Flipping the parameter control should display one graph at a time when titles are hidden.

             

            Please let me know if you have any questions, or if you'd like me to demonstrate the solution, please attach your twbx file here.

            • 3. Re: Use Parameter Control to Change Chart Type
              Andrew Fuenmayor

              Thank you for the reply.  I've got the parameter control now correctly switching between viewing the data as counts and percent of total.  However, one final piece I am struggling with is getting the data labels to change from whole numbers to percents as the chart switches.  Right now when I switch to percents view the labels display as decimals like so:

               

              I can change them to percents but then when I switch the parameter control back to counts I get all those >1 whole numbers trying to display as percents.  Is there another calculation I can add that will change the formatting based on the parameter control?  Thanks again.

              • 4. Re: Use Parameter Control to Change Chart Type
                Marc-Anthony Di Biase

                To fix this you'll have to use a dashboard rather than a single graph, as you've done above. Split the IF statement into to separate calculated fields;

                IF([parameter name] = 'Number of Records' THEN [Number of Records] END

                IF([parameter name] = '% of total records' THEN [percent of total records] END

                 

                Place these on separate graphs with the desired axis (Number of records and percentages), and both of these sheets on the same dashboard, with the parameter control.

                 

                If done correctly, it should only display one or the other graph on the dashboard (I recommend putting them in a h or vbox together for sizing.)

                 

                Let me know if this helps!