3 Replies Latest reply on Nov 29, 2018 11:37 AM by Don Wise

    Change integer into a string across multiple fields

    Dustin Fleming

      I have been trying to manipulate the data in this data set to show the effectivenes of different nutritonal diets the issue that I ran into is that there are several values that are integers i.e. for gender male is 1 and Female is 0 and the same is true with if a participant is on a certain diet or not. So if a  participant was on a Paleo diet the value would be 1 for that participant and then they would be listed as a 0  for a Gluten Free diet. So when it is formatted that way it does not translate very well to any viz that I have been able to come up with.


      What I would like to be able to do is group the participants of eacch diet together and then seperate them by male and female participants once I have done that my goal is to show what diet reulted in the most weight lost in percentage form.. I thought that sounded like it would be fairly simple but I have been very wrong so far. Thank you for any help you can point me towards or can provide.

        • 1. Re: Change integer into a string across multiple fields
          Don Wise

          Hi Dustin,


          This should get you started:

          Screen Shot 2018-11-29 at 10.16.36 AM.png

          1 of 1 people found this helpful
          • 2. Re: Change integer into a string across multiple fields
            Dustin Fleming


            Thank yoiu so much for the help. In all honesty I am a total newbie at Tableau (taking a class for my masters) and I am not super sure about the calculated fields you created and how you came up with them to be able to get these results to display. So I will break those down first but the other question I have is how would you suggest I go about visualizing this as opposed to just another Spreadsheet view? Is that something that is possible with this data set? This "spreadsheet" does show what I want but I need to make it pretty you know what I mean? Also Just so I know that I am munderstnding the way the info is displayed in the Count Accepted Diet column those numbers break down as such male number of participants number of female participants adn the total number of participants? Thanks again and sorry for all the follow up questions I just want to make sure I am absorbing the information you provided.

            • 3. Re: Change integer into a string across multiple fields
              Don Wise

              Hi Dustin,

              No worries about being a newbie with Tableau! We were all there at one point or another. Here are a couple of examples, just duplicate the table of data and then use 'Show Me' in the upper right-hand corner to see what Tableau recommends based on the available data. Drag 'Gender' to color and click color to edit color for either Male or Female.


              To answer your 2nd question, yes, it is break down within Accepted Diet Name, how many males vs females accepted the diet, with a subtotal for that particular group, overall percentage is for all 106 participants. 


              The only calculation I provided you is a sum total of all the percentage values already provided.  Not sure about the underlying data collection methods and results? If you were to turn each of those numbers into an actual percentage and not a decimal you'll see percentages greater than 100%. 


              A person wouldn't lose over 100% of their body weight but some of those values added up would indicate that.  So maybe go back to the provider of the data to better understand what those values mean? Then total as appropriate.  I provided you the calc as an example of how to get there.  To see the calculation, simply right click on the pill Total Loss and click edit.  It may be that the 28-day value is the final value and the other values shouldn't be summed - but only you'll know your data better than me .


              What I did get out of it is something like the following: 17% of all respondents accepted the Slow-Carb Diet, which was the highest acceptance rate, and also had the highest weight loss, whereas 3% of respondents using the Flossing Diet actually increased their weight significantly.


              Thx, Don

              Screen Shot 2018-11-29 at 11.21.40 AM.png

              Screen Shot 2018-11-29 at 11.24.16 AM.png