
For this week’s #WOW challenge we’re focusing on parameter driven axes ranges.
Building the basic viz
After connecting to the dataset, add Sales to Columns and Profit to Rows. Add Customer Name to Detail and change the mark type to circle.

The chart is divided by reference lines which I chose to define as parameters (but these were additional to the ones mentioned in the challenge requirements).
pProfitRef
integer parameter defaulted to 0

pSalesRef
integer parameter defaulted to 5000

Add both parameters to the Detail shelf, the add a reference line on the Sales axis that refers to the pSalesRef value.

and then repeat and add a reference line to the Profit axis referencing the pProfitRef field.

To colour the 4 segments of the chart, create new fields
Sales per Customer
{FIXED [Customer Name]:SUM([Sales])}
and
Profit per Customer
{FIXED [Customer Name]: SUM([Profit])}
These capture the total sales / profit at the customer level, and we can then determine which quadrant each customer is in by
Cohort
IF [Sales per Customer]>=[pSalesRef] THEN
IF [Profit Per Customer]>=[pProfitRef] THEN ‘High Sales, High Profit’
ELSE ‘High Sales, Low Profit’
END
ELSE
IF [Profit Per Customer]>=[pProfitRef] THEN ‘Low Sales, High Profit’
ELSE ‘Low Sales, Low Profit’
END
END
Add this to the Colour shelf and adjust colours to suit. Then set the opacity to 50% and increase the size of the marks a bit.

To add matching coloured borders around the marks, add another instance of Profit to Rows. Change the mark type of the 2nd Profit marks card to Shape and change the shape to be an open circle. Set the opacity to 100%. Set the chart to dual axis and synchronise the axis.

Adjust the Tooltip and hide the right hand axis (uncheck show header).
Dynamically adjust the axis
The axes will change by adjusting them to refer to parameters. By default we need the axis to try to replicate what it gets set to automatically. For this we need to capture the maximum and minimum sales and profit values and add a ‘buffer’ to give the extra space. I played around with a few options for the buffer, so created a parameter to store this until I got the value that seemed to work best (again this was an additional parameter that I added to just help not having to change multiple calculated fields as I got the value I wanted.)
pBuffer
integer parameter defaulted to 2000

Then create 4 fields to define the max & min of the two measures +/- buffer
Min Sales + Buffer
{MIN([Sales per Customer]) – [pBuffer]}
Max Sales + Buffer
{MAX([Sales per Customer]) + [pBuffer]}
Min Profit + Buffer
{MIN([Profit Per Customer]) – [pBuffer]}
Max Profit + Buffer
{MAX([Profit Per Customer]) – [pBuffer]}
Then create 4 parameters which will define the values we ca use to set the axis
pX-Min
float parameter that is set to the Min Sales + Buffer field when workbook opens (selecting this will then populate the value)

Create further parameters
pX-Max
float parameter that is set to the Max Sales + Buffer field when workbook opens
pY-Min
float parameter that is set to the Min Profit + Buffer field when workbook opens
pY-Max
float parameter that is set to the Max Profit + Buffer field when workbook opens
Once all the parameters exist, edit the Sales Axis and change the axis to use a custom range that references the pX-Min and pX-Max parameters

Do the same for the Profit axis, but reference the pY-Min and pY-Max parameters instead.
Finally while we’re still on the workbook, create two new fields
True
TRUE
and
False
FALSE
and add these to the Detail shelf. We’ll need these later to stop marks highlighting when we click.
Name the sheet Scatter or similar.
Building the Reset button
This actually requires another sheet (even through the requirements says 1 sheet).
Create a new field
Reset Axis
‘Reset Axis’
Add this to the Text shelf of a new sheet. Change the mark type to shape and select a transparent shape (refer to this blog to understand how to create this).
Set the view to Entire View and align the font middle centre and increase the font size. Set the background of the whole worksheet to black. Adjust the tooltip. Add Min Sales + Buffer, Max Sales + Buffer, Min Profit + Buffer and Max Profit + Buffer to the Detail shelf, along with the True and False fields.

Name the sheet Reset or similar
Adding the interactivity
Add the Scatter and Reset sheets to a dashboard, removing any parameters/legends etc that get added. Create dashboard parameter actions to set the axis parameters when selections are made on the scatter plot:
Set X Max
On select of the Scatter sheet, set the pX-Max parameter, passing in the maximum value of the Sales field.

Set X Min
On select of the Scatter sheet, set the pX-Min parameter, passing in the minimum value of the Sales field.
Set Y Min
On select of the Scatter sheet, set the pY-Min parameter, passing in the minimum value of the Profit field.
Set Y Max
On select of the Scatter sheet, set the pY-Max parameter, passing in the maximum value of the Profit field.
Also create dashboard parameter actions to ‘reset’ the axis parameters when the Reset button is clicked:
Reset X Min
On select of the Reset sheet, set the pX-Min parameter, passing in the minimum value of the Min Sales + Buffer field.

Reset X Max
On select of the Reset sheet, set the pX-Max parameter, passing in the maximum value of the Max Sales + Buffer field.
Reset Y Min
On select of the Reset sheet, set the pY-Min parameter, passing in the minimum value of the Min Profit + Buffer field.
Reset Y Max
On select of the Reset sheet, set the pY-Max parameter, passing in the maximum value of the Max Profit + Buffer field.
All these 8 actions should now combine to drive the ‘zoom & reset’ functionality.
Finally, the last step to make the display ‘nicer’ is to deselect the marks from being highlighted when selected. Add a dashboard filter action
Deselect Scatter
on select of the scatter object on the dashboard, target the scatter sheet directly, passing the selected fields of True = False. Show all values when the selection is cleared.

Repeat an create a similar action for Deselect Reset.

And that should be it. My published viz is here.
Happy vizzin’!
Donna












































