1 Reply Latest reply on Apr 16, 2018 10:25 AM by Patrick A Van Der Hyde

    Scatterplot data only runs along x and y axis, how do I make them dependent on each other?

    Fani H

      Hello!

       

      I'm using the Canadian Nutrition File (CNF) and I'm trying to graph each food by its protein and calories except when I put it on a scatterplot, it looks like an "L".

       

      This is similar to what I'm trying to achieve, where it's easy to discern which foods are highest in protein per calories and whatnot.

      Picture

       

      Bonus question: My "Protein per Calorie" calculated measure doesn't work when I multiply or divide my calculated measure for "Protein" and "Calories" but it works when I add or subtract. How do I fix it so it gives me protein per calorie?

        • 1. Re: Scatterplot data only runs along x and y axis, how do I make them dependent on each other?
          Patrick A Van Der Hyde

          Fani

           

          Looking at the raw data, the rows for each food ID are repeated several times.  Most of those values are 0 for Calories and the corresponding Proteins for the same food id are on a different row.  The visualization you created does not aggregate the total per food ID.  It currently shows every row in the data so the pairs of values are Calories with a zero Protein and Proteins with zero calorie.  This is what creates the L shape. 

           

          First - aggregate your data by selecting "Aggregate measures" from the Anaysis menu.

           

          Second, the level of aggregation needs to be understood so place the Food ID value and I suggest the Food Description field on the Marks shelf.  With this we can see the values for every food in your data set on the scatterplot. 

           

          as for your field - try changing the fields to use aggregation - (IF sum([Protein])>0 THEN 100 ELSE sum([Protein]) END) / (IF sum([Calories])>0 THEN 1000 ELSE sum([Calories]) END)