Same scale for scatterplot X and Y Axes

Version 5

    This example uses the Sales and Profit measures of the Superstore Sales sample data.  Of course, in this example, Sales will always be larger in aggregate than Profit.  However, this technique should work for any two measures.

     

    1. Create a calculation that will give you the measure with the maximum value.


    Profit or Sales (max value)

    IF WINDOW_MAX(SUM([Profit])) > WINDOW_MAX(SUM([Sales])) THEN SUM(Profit)

    ELSE SUM([Sales])

    END

     

     

    Place this on both Rows and Columns to get a scatter plot with the axes having the same scale.  You can also turn on the trend line to create a 45 degree sloped line that will allow you to easily see which measure is larger for the given level of detail.

    1.png

    2. Create a corresponding field that gives you the other measure:


    [Profit or Sales (other)]

    IF WINDOW_MAX(SUM([Profit])) > WINDOW_MAX(SUM([Sales])) THEN SUM(Sales)
    ELSE SUM([Profit])
    END
    
    
    
    
    
    

     

     


    Place it on the Rows.  Now you can use the marks card to do things like make the marks on the line small and transparent.

     

    2.png

     

    3. Now make the (other) field a dual axis.  Synchronize the axes so the scales match.  You can hide the header for the axis on the right.

    3.png


    Almost there!  It's just a little hard to tell which axis is which, so a couple more calculations will give us the labels. 4. Create the Label calculations (they are almost identical to the original calcs).  Place them on Rows and Columns.


    Profit or Sales (max value) label

    F WINDOW_MAX(SUM([Profit])) > WINDOW_MAX(SUM([Sales])) THEN "Profit"
    ELSE "Sales"
    END
    
    
    
    
    
    

     

     

    Profit or Sales (other) label

    IF WINDOW_MAX(SUM([Profit])) > WINDOW_MAX(SUM([Sales])) THEN "Sales"
    ELSE "Profit"
    END
    
    
    
    
    
    

     

     

     

    Edit the Axis and remove the existing label since you now have calculated ones.  Here's the end result:

     

    4.png