9 Replies Latest reply on Oct 19, 2016 11:58 AM by Mateusz Pozar

    Newbie: Frequency of answer div by number of respondents

    Mateusz Pozar

      Good evening all!

       

      I'm just getting started with Tableau and have watched a bunch of tutorials, but am having trouble getting off the ground.

       

      I've imported a CSV with numerical fields with an integer range of 1-5. The field also allowed for no answer, so there's a bunch of nulls in there. I would like to create a bar graph comparing the amount of responses per range, like this:

      renspons-range.gif

      The data for the graph above all comes from the same measure, but I can't for the life of me figure out how to get it done in Tableau. I've found the filter function to exclude null values, but that's as far as I've got. Poking around with different measure settings haven't yielded any results.

       

      I'm comfortable navigating the interface, but data visualisation applications are completely new to me and I'm not sure of the terminology, so if I've phrased the question awkwardly do let me know. I'll keep watching the tutorials but this seems a simple function and I'd love to learn how to think to get this done. Any suggestions are more than welcome.

       

      Cheers!

      Mateusz

        • 1. Re: Newbie: Frequency of answer div by number of respondents
          David Li

          Hi Mateusz, and welcome to Tableau and our community!

           

          I wasn't exactly clear on how your data was laid out, but let's assume that you only have one field that contains the integer [1-5] answer. Tableau probably made this into a measure, but it's actually more like a dimension! Try clicking and dragging it from the Measures section into Dimensions. Then, drag the field (which Tableau now considers a dimension) into the columns shelf. Then, drag [Number of Records] into the rows shelf. That will probably give you what you want to see. If not, let me know!

           

          EDIT: Just in case you don't know, numeric fields are not always measures. They can definitely be dimensions. In this case, the integer answer is more like a dimension because you wouldn't actually aggregate that number itself. That is, you wouldn't add up an answer of 3 to an answer of 4 and so on. They're more like IDs, and IDs are dimensions.

           

          EDIT2: Also, you could treat a field in the Measure section like it's a dimension without dragging it into the Dimension half of the data panel. You would just right-click the pill in the shelf, click Dimension, then right-click again and click Discrete.

          2 of 2 people found this helpful
          • 2. Re: Newbie: Frequency of answer div by number of respondents
            Luciano Vasconcelos

            Hi.

            See this one.

            1 of 1 people found this helpful
            • 3. Re: Newbie: Frequency of answer div by number of respondents
              John Croft

              So the attached looks like what you mock up in your original question post.

               

              In the data source, responses originally came in as a measure (green pill). I had to right click and convert to discrete. Then I used my right mouse click to drag it to the columns shelf. And then selected Response (not ATTR(Response)). See below.

               

               

              Then I used my right click to drag responder to the rows shelf. I selected CNT(Responder) [You could just use Number of Records Pill to see this]. Then repeated the process to slect CNTD(Responder). Just depends if you want to count all responses per person or only the distinct names of people who responded.

               

              Here's a screen shot of the basic result. Let me know if you have any question or need additional clarification.

               

               

               

              John

              • 4. Re: Newbie: Frequency of answer div by number of respondents
                Mateusz Pozar

                Sweet, that did the trick! Thanks a bunch David, much appreciated.

                 

                Result

                Screen Shot 2016-10-19 at 18.19.59.png

                 

                I saw the intro video on the difference between dimensions and measures, but didn't realise that it would treat the data differently depending on which of those categories the fields ended up in – i thought it was just a way of sorting the fields into "most likely content" for UI purposes.

                 

                A follow-up

                 

                I have 4 fields in my CSV, and they all contain answers to the same question: How would you rate alternative n on a scale from 1-5? (Possible field content is null or integer 1-5)

                Following your advice above I could create seperate sheets with a graph for each of these four dimensions, but thought it'd be nifty to have them on the same sheet so they'd be easier to compare. But dragging another dimension onto columns yelds the following result, and I'm curious why that happens:

                 

                Screen Shot 2016-10-19 at 18.28.02.png

                 

                Could you help me understand what Tableau is thinking here, so that I can adjust my thinking?

                 

                I would expect that the result should be something like this (mocked up in Photoshop)

                 

                dummy.jpg

                 

                If there's an order-of-things document or tutorial I ought to read to understand this better, do let me know.

                 

                Cheers!

                Mateusz

                • 5. Re: Newbie: Frequency of answer div by number of respondents
                  John Croft

                  I think you would need to rearrange the data from horizontal to vertical. So you would need a general Alternative column that identifies each alt n from 1 to 4. But the below would be the result. See attached.

                   

                  1 of 1 people found this helpful
                  • 6. Re: Newbie: Frequency of answer div by number of respondents
                    Mateusz Pozar

                    Good evening John,

                     

                    Thanks for your input, much appreciated. Looking at your data source, yours look different than mine which migh account for why I don't get your suggestion to work.

                     

                    Your exemple data is arranged like so:

                     

                    User| Alternative | Rating

                    a   | 1           | 4

                    a   | 2           | 2

                    a   | 3           | 4

                     

                    While my data fields look like this:

                     

                    User | Rating alternative 1 | Rating alternative 2 | Rating alternative 3 |

                    a    | 4                    | 2                    | 4

                    b    | 2                    | 3                    | 2

                     

                    Should I massage the fields in the data source before I start working on them on the sheet, or how ought I to think here?

                    • 7. Re: Newbie: Frequency of answer div by number of respondents
                      John Croft

                      Yes I think you'll need to rearrange your data source. Typically we use SQL to manipulate ours. 

                       

                      I'll see if there's a way I can do something in the Tableau application a little later today.

                      • 8. Re: Newbie: Frequency of answer div by number of respondents
                        John Croft

                        Okay so I think this should be easy and pretty straight forward for you. I'll step you through with screen shots below. Let me know if you have questions.

                         

                        Step 1: Click on the data source tab at the bottom of the Tableau application.

                         

                         

                        Step 2: Use shift click or control click to highlight the four alt N columns (I'm not sure if Response is a separate column vs the four Alternatives - you'll need to figure out if you need to include it or not based on what your data source looks like).

                         

                         

                        Step 3: Right click on of the highlighted columns and select 'Pivot'. The data should now look like the below. You can rename the Pivot field names and Pivot field values as needed.

                         

                        1 of 1 people found this helpful
                        • 9. Re: Newbie: Frequency of answer div by number of respondents
                          Mateusz Pozar

                          After some fiddling, that worked a treat. Thanks a lot for your help John!