8 Replies Latest reply on Jul 5, 2016 9:16 AM by Simon Runc

    Before and after graph

    Salvador Camacho

      Hi guys!

      Like many of us, I am super new with tableau but I'd like to know if a "before and after" graphic can be developed, just like the one attached.

      We did an intervention aiming to reduce people's weight. So we want to show the change from weight1 to weight 2, united by a line.

      We have three groups and around 70 persons in each group. Each group meaning a different kind of intervention.

      I am kind of lost in what would the best way to show our results would be. Could somebody help me?


      Thanks a lot!

        • 1. Re: Before and after graph
          Simon Runc

          hi Salvador,


          Yes we can do a slope chart in Tableau...attached is an example done with Superstore. Like your scenario, I've put Sub-Category in the detail shelf (so I get a line per Sub-Category...your 70 users), and then put Category on the colour shelf (your 3 groups). It will depend on the 'Shape' of your data on whether you can replicate it this way exactly. If you can post some data (anonymised) I can take a look.


          In terms of some Viz ideas....I think the slope chart is pretty good for this. You might want to make the Max/Min of each group bolder (I can show you this if you post some data)... and you might also want to think about creating a dashboard (which is a combination of vizes, which have interactivity)....so you can see the average-loss [in %age] (and maybe extremes, or variance) of each group, and then use the slope chart for looking at the detail.


          hope that helps

          1 of 1 people found this helpful
          • 2. Re: Before and after graph
            Shinichiro Murakami

            Just a quick sample.


            [X % Reduced or not]

            if (([After]-[Before])/[Before])*100*-1 > [Param.Reduced %]

            then "More than "+str([Param.Reduced %])+"% Reduced"

            else "Not enough"





            9.2 attached

            1 of 1 people found this helpful
            • 3. Re: Before and after graph
              Michael Hesser

              Hi Salvador:


              Bells & whistles should follow functionality, but I wanted to throw this in: the curves of a Sankey diagram might offer an aesthetic view to your viz, and still preserve the data. This might be apropos since you're talking about people's "curves"


              The fantastic responses you've received above are wonderfully thorough-- and I know you're just starting with Tableau. But once you have those intrinsic pieces down, then something like this may appeal to you.


              I've attached a quick mock-up.

              1 of 1 people found this helpful
              • 4. Re: Before and after graph
                Salvador Camacho

                Thanks a lot for such wonderful answers! I have tried all of them and all of them work awesome!

                Simon Runc how can I make it anonymous? Shall I go directly to my source and modify the file? (it is an excel file?) or is there a "shortcut" in Tableau to do it?

                Shinichiro Murakami thanks for the answer! I have a doubt though, if one value (I am using zscores) passed from -2 to -1.5 it would be an improvement but with the calculation that you proposed it would not be reflected like that, right? How can I correct this so it makes sense also for negative values?

                Michael Hesser That curve looks absolutely great for presenting my findings! would you mind to explain me more about the Sigmoid function? I am not familiar at all with that. Or where can I get more info about it, so I don't bother you


                Thanks to all of you, I really appreciate it!

                • 5. Re: Before and after graph
                  Simon Runc

                  hi Salvador,


                  Unfortunately no short-cut directly in Tableau, so you'll just need to change the 'Names' in your file to say numbers (1,2,3,4...), if you have it in something easily editable (like an Excel Spreadsheet). Else here a video one of our Tableau Ambassadors did on how to easily anonymise a workbook (also has some other handy hints in too!...so worth a watch regardless)


                  Anonymize your Tableau Package Data for Sharing

                  1 of 1 people found this helpful
                  • 6. Re: Before and after graph
                    Salvador Camacho

                    Thanks Simon. So, here is my workbook. I used the solution from Shinichiro but I changed it to a more simple way. You will noticed. Else I am kind of lost. Any help of how to properly visualize it, is more than appreciated!

                    • 7. Re: Before and after graph
                      Michael Hesser

                      Hi Salvador--


                      I LOVE Sankey diagrams, but I'm no expert. If you, too, find yourself in AWE of them, you can learn much much more here:


                      Data + Science


                      And here (but fasten your seatbelt!!):

                      Sankey diagram made of dynamically generated polygons


                      Olivier CATHERIN and Jeffrey Shaffer  (plus several others mentioned in their articles) are the true wizards: I merely stumble in their footsteps


                      So read, read, read and enjoy! And be sure to thank these folks for the hard work they've done!


                      Since you asked, here's my take on the Sigmoid function:


                      The Sigmoid function is key to putting the elegant curve into the lines. It does this by generating a number between 0 and 1 which it applies to the difference of the start and end values.


                      The resolution of your lines is based on the number of nodes you select in the linked file. In the example I provided I created 20 nodes which I believe gives a good aesthetic quality.


                      Nuts & Bolts: I numbered the nodes 1 through 20, which wasn't very smart on my part : if you number your nodes from, say, -10 to +10, you won't need to worry about this little highlighted piece in the Sigmoid calculation which serves to "center" the curve:


                      Other considerations: be cautious when displaying a Sankey diagram, especially for the purpose you've outlined: it would be easy (maybe intuitive?) for a viewer to assume this represents weight loss over time, rather than start to finish. You may inadvertently be misrepresenting your data which can be a very, very bad thing.


                      Remember: flash follows functionality & utility; if this type of display will confuse your message, go for a different option


                      Good luck to you!

                      1 of 1 people found this helpful
                      • 8. Re: Before and after graph
                        Simon Runc

                        hi Salvador,


                        it will depend on the purpose of your Viz...is it to 'analytically' investigate the data? to clearly show a conclusion?...or a flashier info graphic affair?...either way Michael's advice is very sound. Even if option 3, it still has to convey accurately what happened....as a  quick example check this Info-graphicy Viz out


                        Seems to tell a certain story...however this is an example of writing the story first and building the Viz to suit the storey....flip it over


                        Oh death on the decline in iraq!! (but that's not the story they wanted to tell...don't want to let things like facts get in the way....rant over!!


                        So as I don't know your exact use-case I've built you up a dashboard with a few options. I think, from an analytical perspective, the box plots and scatter plots are pretty good. I a dashboard it (generally) a good idea to start with some very high-level (aggregated) summary, and then (which is what the scatter plots do) show the detail after that (you can also use actions to create interactivity between the Vizes)


                        So on the dashboard....there is a Bar Chart showing the Average Z-Score Change %age, but Group. Then one showing a count of Reductions/No-Reductions. Then below we have a scatter plot showing the individuals, with the bands being 1 Stand Dev. Below that we've then got a box-and-whiskers chart (where I've set it to only display marks for the outliers)


                        I'd also caveat that I don't know your data, so may have picked the wrong measure for %age ZScore change, but hopefully you can just switch in the 'right' measures.


                        Hope that helps

                        1 of 1 people found this helpful