For Workout Wednesday Week 50, the challenge was to create a dot plot and a line connecting 2 dots of sales and cost, need to give a colored border to the circle and create a centered line for each subcategory. You can check more details about the Challenge here.

Looks like this challenge was of moderate difficulty. Let's start with the challenge.

First, create a calculation for Cost.

SUM([Sales])-SUM([Profit])

Add Measure Values to columns and add Measure Name to filter.


Create a calculation for Coloring the Lines.

Color Profit
SIGN(SUM([Profit]))

Change it to Discrete, and drag it to the Color Marks Card.

Let's keep it like this and try to create dots. Add another pill of Measure Values to columns, and change marks type to Circle. Now if you have checked, there is a predefined calculation on circle marks (AGG(Color Profit)). Now, this color is already there on lines, and the requirement is to color the circles in a different way. 

If you replace Color Profit with Measure Names, it will work for the first requirement (Level 1) where you do not need any border or you can keep the same border for both the circles. If you want to stay with Level 1 Continue to the next step, but if you are trying to create level 2, there is an extra step in between.

Extra step: Create a duplicate calculation of Cost with the name [Cost for Border]. And add this calculation to the Measure Values along with Cost and Sales. Also, add [Color Profit] calculation to the color card of 2nd Measure Values along with Measure Names. Now there are 2 color pills on the 2nd Measure Values color card. (How to do this: First add [Color Profit] to Details, then click on 3 dots next to the [Color Profit] Pill and change the type to Color.)

Why? Because this step will give you 2 extra color options for the Original color of the circle and the Border of the Circle.

Now a few more steps to achieve the view: Make both the Measure Values as dual-axis, Synchronize Axis, Adjust the color of the Measure Values, Adjust the size of line and circles. And you are 95% done.

The last step is to add a centered line to all the Subcategories. If you have noticed, the default table structure is to have lines above and below the categories (Called Column Dividers).

To achieve this, Create a min(0.0) calculation in rows. This will give you an axis as a 0 line passing from the center of the Subcategories name. Now you can hide the table Dividers and do some formatting.

Finally, do the below settings for your labels.

This is your final view. Check the visualization here.

Happy holidays! 🎄

Post a Comment

Previous Post Next Post