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])




    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.


    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])



    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.




    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.


    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"



    Profit or Sales (other) label

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




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