4 Replies Latest reply on Mar 13, 2014 7:32 AM by Alfred Gimenez Bonastre

    Bar Chart  Accumulated in Years

    Alfred Gimenez Bonastre

      I have a problem with a sheet, and this is where I have a bar chart that counts the number of patients I have in years / months selected. I wanted to go a little further and use a cumulative, I mean:

       

       

      I have the field year as a quick filter, so I can see how much I have in 2012, 2013 or 2014, ok. If I decide to see what I have in 2013 and 2014 I would like that the first bar shows the number of patients created during the previous period, but now it shows me only the number of patients created in that month, so, the acumulated starts in 0, but I want that it starts with the total acumulated of previos month.

       

       

      To give an example: If in December 2012 I have a total of 10000 patients, if I select only the filter 2013 and 2014, the month of January it would have to show 10000 + new patients created in January 2013, so, acumulating the number of patients.

        • 1. Re: Bar Chart  Accumulated in Years
          Matt Lutton

          If you can mock up a sample packaged workbook (use sample Superstore data or randomize a subset of your data, pull into Tableau as an extract, and post that), someone will be happy to help.  Its very difficult to advise based on a text description alone, as Tableau is such a visual, interactive tool--plus, a lot depends on your data and how the view is setup.

           

          You'll get faster, more reliable help, if you can mock up a sample packaged workbook and post it here Cheers!

          1 of 1 people found this helpful
          • 2. Re: Bar Chart  Accumulated in Years
            Dan Huff

            This might be fairly easy to accomplish. Create the following calculation:

             

            lookup(min(year([Your Date Field Here])),0)

             

            Now, remove the filter you have on year and add the above calculation to the filter shelf.

             

            This calculation finds the value for year for every mark in the table and builds up a list for you that can be used to "filter" marks. What is actually going to happen is that Tableau will hide the marks. When you use your normal quick filter, a WHERE clause is actually inserted into the query that explicitly removes unchecked years from the query. This means that you get no data for those years so the running total will always start at 0 for you first remaining year.

             

            This calculation, on the other hand, does not add a WHERE clause into the query as it is a table calculation. This allows us to get data for all years, compute our results, and then hide the marks for the years we don't want to see without affecting the running total.

             

            Feel free to reply here if you need an example. I am just not at a computer with Tableau right now.

             

            Dan

            • 3. Re: Bar Chart  Accumulated in Years
              Alfred Gimenez Bonastre

              Sorry fot not answering before, but I have done a trip and it was impossible for me to try the solution. I have proved what have you said and it works propertly!

               

              Thanks you very much for your help!

               

              Alfred

              • 4. Re: Re: Bar Chart  Accumulated in Years
                Alfred Gimenez Bonastre

                Hi Dan!,

                 

                Sorry, one question. How I can make the quick filter is a dropdown and not a slider as shown in the image.? I think that the method is possible with parameter, its ok? but i don't know if its ok.

                 

                I send you and image and TWBX if you want see the project.

                 

                Once again, thank you very much

                 

                Regards,

                Alex.

                Captura de pantalla 2014-03-13 a la(s) 15.25.45.png

                Captura de pantalla 2014-03-13 a la(s) 15.25.31.png