8 Replies Latest reply on Apr 24, 2017 11:35 AM by Jim Dehner

    Bin results by count

    Scott Henry

      Hello -


      I'm absolutely brand new to Tableau. I know this must be a very simple question -


      I have a dimension of text named 'sources', like 'Fair', 'Email campaign' etc. Each 'source' has a count of records for each given time period, let's call it a quarter. My goal is to create two bins, 'major sources' and 'minor sources', where the major sources are listed by name, and the minor sources are just referred to as 'minor source'. Basically, I just want to alias all the names in the dimension that fall under a certain threshold.


      The goal end result is a bar chart, where there are a series of bars for the major sources where height = count, and one bar for the all the minor sources combined.


      Again, I know this is probably very simple, and I'm probably missing something obvious. I've tried multiple calculated fields, ie, IF COUNT(Source) < 10 THEN .... , but I end with with a measure rather than a dimension (probably because the calculation is dynamic, based on quarter). If I try to use the [source] field in the calculation, I run into errors like 'cannot mix aggregate and non-aggregate'.


      Hopefully this is clear! Again, I'm brand new to this!

        • 1. Re: Bin results by count
          Jim Dehner

          Hi welcome


          here you go - try this

          IF sum([Sales])< 100000 then "Group 1" else "Group 2" end


          Where you can fill in the values and names


          Let me know if this helps


          1 of 1 people found this helpful
          • 2. Re: Bin results by count
            Jim Dehner

            Scott I meant to attache this - you end up with something like this - the field is listed under measures but you can use just drag it up to rows etc



            1 of 1 people found this helpful
            • 3. Re: Bin results by count
              Matthew Risley

              Scott! Welcome to Tableau! We can certainly help you out.


              Personally, I'm finding it hard to understand what you'd like to do - especially without some sample data. Could you possibly add some mock-data or a tableau workbook (.twbx) Packaged workbooks: when, why, how 


              Binning can be done in two ways. either by dragging a single measure to the view, and using the "Show Me" tab:

              or straight from the measure:


              You may also want to look into groups or sets:


              Now I may be wayyyyy off... Perhaps I'm just misunderstanding what you'd like to do.


              We're here to help!

              1 of 1 people found this helpful
              • 4. Re: Bin results by count
                Scott Henry

                You guys are great! Thanks for spreading info to the newbie!


                Jim - I feel like I'm getting close. I've gotten to the 'Group 1' vs. 'Group 2' , but what I'd like is to have 'Group 1' vs. 'Appliances' , 'Accessories', 'Binders' , so I suppose 'Group 1' should be summed together, and each name separately in other group.


                I'll try to clean some data for publishing to help explain.

                • 5. Re: Bin results by count
                  Jim Dehner

                  Scott there is another way if you know before had what you want to group  and what you want to leave separate


                  You can simply right click the dimension in the try and select group - a window will open and you can select the member you want to group then click OK


                  You can then rename the group




                  1 of 1 people found this helpful
                  • 6. Re: Bin results by count
                    Scott Henry

                    Thanks Jim,


                    I suppose I don't know which categories go in which group until the results are totaled. I'll get a mock up workbook and see if I can better explain. Thank you guys for helping!

                    • 7. Re: Bin results by count
                      Scott Henry

                      Okay - I think I figured out one way to solve this! Thank you guys for your insight!


                      First, I used the 'Sets' feature to create a set on the Condition -> By Field: Number of Records where Sum < 10 (my threshold). Of course, this just provides an In vs. Out.


                      I then made a calculated field: IF [Set] = False THEN [source] ELSE 'minor source' END


                      That gives me the total for all the 'minor sources' versus all the others! I think that's what I was after! Thank you so much for helping!

                      • 8. Re: Bin results by count
                        Jim Dehner

                        Glad to help out

                        If you will mark the reply helpful or correct it will close out the thread