7 Replies Latest reply on Oct 16, 2017 8:00 AM by Michael Gillespie

    Divide day in two parts

    Joel Thanos

      Hi guys!


      I have some data about the rendement of a machine, that works in morning and evening shifts.
      The data I have looks as follows:

      DatumMorning shift Rendement
      Evening shift Rendement

      I have made a graph, in which the rendement of the morning or evening shifts is compared to a certain goal (see image below)


      So each dot in the image represents a date (in days). The black line is for the morning shift. I have another graph like this for the evening shift. I would like to merge these two graphs into one. This means that in stead of one dot per day, I now need two dots per day (morning and evening shift) each corresponding to the right rendement. So in the end, I will end up with two dots per day and one black line, which represents the morning and evening shifts combined.

      I have no idea how I can get this done. I have spent hours on the internet looking for a solution but I couldn't find one.

      I would really appreciate your help!

        • 1. Re: Divide day in two parts
          Sherzodbek Ibragimov


          You can achieve that if you use dual axis of evening and morning shift measures as seen below:

          • 2. Re: Divide day in two parts
            Joel Thanos

            Dear Sherzodbek Ibragimov,


            Thanks for your reaction. This is however not what I had in mind (maybe I also was not clear enoug).

            I already youse double axis. I also have a measure for the 'Goal', which is always 80%.
            So I have a horizontal line at 80% represented in the dots and then I have a normal line for the morning shift.However, I guess I need to make some sort of calculated field to get morning and evening shift in one line, one measure.

            So where each day has two values (one for morning and one for evening).

            • 3. Re: Divide day in two parts
              Tushar  More

              Hi Joel,


              Is this what you are looking for?



              • 4. Re: Divide day in two parts
                Joel Thanos

                Dear Tushar More,


                Thank you for your reaction. I have also tried this actually.

                This was my first solution to the problem also, however, (maybe I also forgot to mention this) as you can see now the morning shift can be above the goal and the evening below. What color should the spot have then? The graph I have now has one line, so the dot is either green or red based on whether the goal is reached or not. If you have two lines, one could have reached the goal and the other not. The purpose of the graph is to easily spot red or green colors so you can easily see how the machine is performing.

                So I'd really like to stress that somehow I want these two lines combined in one line, resulting in two measurements (morning and evening) per day.

                • 5. Re: Divide day in two parts
                  Michael Gillespie

                  Joel, this is a little tricky but shouldn't be impossible!  A couple of questions:

                  1) How are the 2 percentage values calculated for Morning and Evening?  Are you calculating them in Tableau?  Or are they just values that exist in the data somewhere?  Do we have access to the raw values (e.g., the numerator and denominator) of the calculation?

                  2) This is important because I'm not clear what value you want for the combination of the Morning and Evening percentages.  Average?  Something else?  Usually, we'd want to sum the numerator values, sum the denominator values, then perform the division to get a combined percentage.  Is that what you want?


                  The better way to get BOTH the 2 dots and the single line (once we figure out how to calculate the value for the single line) is to use the "Measure Values" measure to display the Morning and Evening values, (that's ONE PILL on the Rows shelf) and the NEW calculated field for the combined Morning and Evening metrics as a SECOND pill on the rows shelf, and then make that into a dual-axis viz.


                  If you can upload a copy of your workbook that would be most helpful.

                  • 6. Re: Divide day in two parts
                    Joel Thanos

                    Dear Michael Gillespie,


                    Thank you for your reaction. To come back on your questions:

                    1) They are calculated in excel. The data is about an egg breaker machine. The rendement is calculated by a value for the amount of eggs that were broken that hour divided by the amount of eggs that the machine can actually break in an hour, times 100. So we do have access to the numerator and denominator values seperately.

                    2) I do not want a combined percentage or average of the morning and evening shift. I need them to still be seperately. Below is an image of what I want it to look like.


                    So again: the colored dots represent a constant value which is the goal that needs to be met. The first two dots represent the goal for october 16 morning and for october 16 evening. The next two dots should consequently be the goal for october 17 morning and for october 17 evening, and so on... The line should be the same. The first value point of the line should be october 16 morning, the second october 16 evening, the third october 17 morning, the fourth october 17 evening, and so on...


                    I hope this makes it more clear of what I want to do.

                    • 7. Re: Divide day in two parts
                      Michael Gillespie

                      Ah, yes, that is clearer!


                      I think the PIVOT function is what you need here.  In order to get that line, you need a single column with both Morning & Evening values in it.  If you pivot the Morning & Evening columns in the Data Source tab, you should get the right table layout.   You may have to play around with the date values to make sure everything lines up correctly but that shouldn't be too tough.