Do you feel that you are Tableau Expert? Then try this challenge 1
Here I am coming with real
time challenge. Those who are interested can try this and test your knowledge.
Sample Data looks like below:
In above sample data we have
Items, Sub Items, Hour and Sales Count.
We have 7 Items (Item 1,
Item 2, Item 3, Item 4, Item 5, Item 6 and Item 7), 4 Sub Items for each Item and
we have Sales count by Hours, means how many items sold in that hour. For
example 0 hour means how many Items/Sub Items sold between 12 Am to 1 Am.
Using this data we have to build 3 reports:
Report 1:
This is simple one. Look like
below.
Report 2:
This is intermediate level. You need to do Bin Analysis.
Bins are like : 0 – 20, 20 –
40, 40 – 60, 60 – 80, 80 – 100, 100 – 150, 150 – 200 and 200 – 500
In
above image for 0 hours, 0 – 20 bin size is 6. How we got 6? Look at below
image
Report 3:
This is Very Complex level.
Above
report we are calculating Higher Frequency of the Hour and Max Sale Count
(Hourly)
Max Sale Count (Hourly):
Second Row in above Report
This
is simple we are just calculating Max value of Sale Count for each hour.
For
example let’s see first report image. We have sale count for 0 to 23 hours by
Item and Sub Item.
In
that we need to calculate Max value for each Hour Column.
So
we will get values 123, 133, 176 ……70 with respect to 0, 1, 2, 3 ……23 hours.
Still
if you have confusion at below image:
Higher Frequency of the
Hour: First Row in Report 3
This
is very complex to calculate. This needs expert level knowledge.
To know
how to calculate please look at below image:
Final output of 3rd
report should look like this:
For dataset please download
below workbook:
For more challenges: Click Here
Taking Dashboards from Good to Great with Custom Shapes
Contributor & Author: Tiffany Spaulding
Many
people struggle with bringing graphic design elements into their Tableau
dashboards. Last week, we focused on building better dashboards using custom
color palettes. This week, let’s dive into best practices for using custom
shapes to enhance your Tableau visualizations.
What image file type is best?
When
you perform a search on the internet for icons or shape files, typically you
will have multiple file types returned: BMP, GIF, JPEG, PNG, and TIFF. Tableau
can use all 5 file types; however PNGs (portable network graphics) should be
your go to for two key benefits.
PNG Benefit #1: Transparent
Background
On
a white background, you do not notice the difference between a JPEG shape and a
PNG shape. It's only when the shape is placed on a colored background that it
becomes obvious why to use the PNG. PNGs have a transparent background which
allows shapes to be placed on any color background without concern of an ugly
white square around the icon.
Often,
we need shapes to appear in close proximity to other shapes in view, overlapping
at their edges in certain scenarios. Because PNGs have a transparent
background, they can be arranged close to each other without concern of the
background overlapping a neighboring shape. With JPEGs, the background will
overlap eventually, causing undesirable effects.
Furthermore,
if you use JPEG shapes on a map, you’ll be able to see the background white
space quite prominently. PNGs reveal elements of the underlying map in a
cleaner fashion since their backgrounds are transparent.
PNG Benefit #2: Receive Color
Encoding
In
Tableau Desktop, if we use JPEG shapes and add a field to color on the marks
card, the entire rectangular area of the JPEG is colored, not just the icon.
One-color PNGs receive color encoding as we expect since their background is
transparent.
Where can I find high quality PNG
libraries?
My
go-to is always the Noun Project simply because I love the concept. They are an
open-source global initiative whose mission is to develop a freely accessible
library of icons that will translate across all cultures and languages as a
visual language. The site welcomes and encourages contributions from around the
world and hosts “iconathons” to encourage constant growth to their libraries.
Thanks to the Creative Commons license, most are available for use in Tableau
or other mediums. To get started, simply search by buzzword, scroll through the
library results, and save those you want to your machine (right-click icon
preview and select “Save Image As…”).
I
maintain a list of other equally wonderful icon libraries on the internet. Make
sure to check out the links below for millions of icons available for free.
What tools can I use to build my own
PNGs?
My
go-to tool is Adobe Illustrator but you can use PowerPoint as well. Yes,
PowerPoint can build PNGs. Any shape, textbox, smart art, or element in
PowerPoint can be saved as a PNG by right-clicking and selecting “Save as
Image." I use this most often to convert text to images when sending Power
Points to my team (as I tend to use some non-standard fonts). It also comes in
handy when I need to preserve text on a dashboard that is an unsupported font
on Tableau Server. Changing specialty text to image prevents the text from
returning to a substitute font when they open the file on their machine or
device. The same functionality can be used to bring in images and icons to
Tableau for marks, highlights, logos, drop shadows and buttons.
To
convert PowerPoint graphics to PNGs for use in Tableau, follow these simple
steps:
- In
PowerPoint, right-click the shape or text element you want to convert to
PNG.
- Select
“Save as Picture…” from the right-click menu.
- Name the
file and choose a save location. The file type will default to a PNG.
What file size is best for PNGs?
The
file size will depend on the visualization. Resizing of the shapes is limited
in Tableau as the size slider (Size button on the Marks Card) has a predefined
range. I tend to save three versions of my PNGs to have a low, medium, and high
resolution option. Icons should never be smaller than 32 pixels by 32 pixels. I
tend to save a 50x50, 125x125 and 250x250 version.
How do I add custom shape palettes
to Tableau?
Once
you have identified the icons you want to use, you’ll need to save them to a
very specific location on your computer. Browse the “My Tableau Repository”
(available to PC users in your My Documents folder). Think of the "My
Tableau Repository" as Tableau’s brain. The software looks here for color
palettes, log files, map sources, data sources, and more. Double-click the
“Shapes” folder inside the "My Tableau Repository" and you’ll
recognize that the list of folders within is the exact same as the shape
palettes available by default in Tableau.
To
create a new shape palette, add a new folder within the Shapes folder (don’t
forget to name the new folder). Inside the new folder, save (or copy) any of
the images you want to utilize in Tableau. The next time you open Tableau
Desktop, your shape palette will automatically load. If you have Tableau open
while adding shapes, you can either save and restart Tableau, or use the
“Reload Shapes” button from the Edit Shape menu to refresh the available shape
palettes.
Remember
if you are sharing your work with others through Tableau Server, you’ll either
need to save your workbook as a TWBX (packaged workbook) or ensure your server
admin has added the same shape palette name and contents to the Tableau
Server’s repository.
Jedi Mind Tricks (Advanced Use Case
for PNGs)
Sometimes
we need to show worlds of information in very small spaces. Think about the
process of finding a new home. We search by price, but just as important are
the number of bedrooms, number of bathrooms, garage size, square footage, and
school district. That is a ton of information to show in one view, however we
can combine a few key metrics using iconography and place the other details in
a tooltip. By utilizing PNGs, we can take advantage of the transparent
background to overlay multiple icons into one informative graphic.
I
hope these quick tips help you to think outside the box of the shapes available
in Tableau by default. There are multitudes of free sources to enhance the user
experience. Adding iconography ensures the data translates to all users (no
concern of shape deficient users like we saw with last week’s color palettes).
Remember to always check your work across multiple devices (iPhone, Android,
etc.) as well as to use the smallest image size needed.
How to Create a Custom Color Palette in Tableau
Reference: Click Here
Tableau
Desktop comes with a set of color palettes that have been carefully designed to
work well together and effectively apply color to data in many situations, such
as on maps, heat maps, bars, etc.,. Alternatively, you can add your own custom
color palettes to match your corporate identity or to describe common data
better.
In
general, Tableau offers three types of color palettes: categorical, sequential,
and diverging. You can create your own custom color palette by modifying the
Preferences.tps file that comes with Tableau Desktop. The Preferences.tps file
is located in the My Tableau Repository. The preferences file is a basic XML
file that you can open in a text editor to modify. Unedited preferences file
looks like following example:
Important: Tableau does not test or
support custom color palettes, so be sure to back up your workbooks before you
continue. Also, there is no guarantee that your custom color palettes will work
with future Tableau Desktop upgrades.
You
can add as many custom palettes as you like, each with as many colors as you
want. Make sure each palette has a unique name. The colors are indicated using
the standard HTML format. This is the hexadecimal value #RRGGBB or Red Green
Blue format. When you save the workbook, the color information is embedded in
the file, but it is not included as a reusable color encoding. This means that
any colors that are in use are shown for anybody opening the workbook; however,
if they don't have the modified preferences file, they cannot use the color
information for new color encoding.
Step 1: Edit
your preferences file
- Go to the
My Tableau Repository folder in your Documents directory, and open the Preferences.tps file.
- Between the opening and closing "workbook" tags, insert opening and closing "preferences" tags.
- Choose a
color palette option below and follow the procedure to modify the
Preferences.tps file.
Option 1: Create a custom categorical color palette
A
categorical color palette contains several distinct colors that can be assigned
to discrete dimension members. For example, when you put a discrete dimension
such as Region on the Color, the categorical color legend is used. The
following is an example of what to add between the "preferences" tags
to add a categorical color palette. Note that the "type" attribute is
specified as regular, which identifies this palette as a categorical palette.
- In the
Preferences.tps file, between the "preferences" tags, paste the
following:
<color-palette name="My Categorical Palette"
type="regular" >
<color>#eb912b</color>
<color>#7099a5</color>
<color>#c71f34</color>
<color>#1d437d</color>
<color>#e8762b</color>
<color>#5b6591</color>
<color>#59879b</color>
</color-palette>
<color>#eb912b</color>
<color>#7099a5</color>
<color>#c71f34</color>
<color>#1d437d</color>
<color>#e8762b</color>
<color>#5b6591</color>
<color>#59879b</color>
</color-palette>
- Save the
Preferences.tps file and then restart Tableau Desktop.
- Open the
Superstore sample data source.
- From the
Dimensions pane, drag the selected discrete dimension (e.g., Region)
to Color.
- Click the
color legend menu arrow and select Edit Colors.
- In the
Edit Colors dialog box, from the palette drop-down list, select your new
custom palette.
- Click the Assign
Palette button to assign the custom colors to each respective field.
- When
finished, click OK.
Option 2: Create a custom sequential color palette
Another
type of palette is the sequential color palette. Typically, this type of
palette shows a single color, varying in intensity. This type of color palette
is used for continuous fields, typically for measures. The following is an
example of what to add between the "preferences" tags to add a
sequential color palette. Note that the "type" attribute is specified
as ordered-sequential, which identifies this palette as a sequential palette.
Also, for sequential palettes you must specify each variant of the color in the
sequential color range.
- In the
Preferences.tps file, between the "preferences" tags, paste the
following:
<color-palette name="My Sequential Palette"
type="ordered-sequential" >
<color>#eb912b</color>
<color>#eb9c42</color>
<color>#ebad67</color>
<color>#eabb86</color>
<color>#eacba8</color>
<color>#ebd8c2</color>
</color-palette>
<color>#eb912b</color>
<color>#eb9c42</color>
<color>#ebad67</color>
<color>#eabb86</color>
<color>#eacba8</color>
<color>#ebd8c2</color>
</color-palette>
- Save the
Preferences.tps file and then restart Tableau Desktop.
- Open the
Superstore sample data source.
- From the
Measures pane, drag the measure (e.g., Sales) to Color.
- Click the
color legend menu arrow, and select Edit Colors.
- In the
Edit Colors dialog box, from the palette drop-down list, select your
custom palette.
- If you
want each color gradation to be defined within a box, select the Stepped
Color check box, and in the Steps text box, type the number of
color steps you want to display in the bar.
- Click
the Advanced button.
- Select the Start check
box, and in the text box, type the low end number you want for the
continuum.
- Click the Apply button
to see the result, and make adjustments as needed. The default for
sequential color is to make the high end of the continuum pale and the low
end intense; select the Reversed check box to make the
high end intense and the low end, pale (this is the default when you keep
the Automatic palette selection).
Option 3: Create a custom diverging color palette
The
third type of color palette is a diverging color palette. A diverging palette
shows two ranges of values using color intensity to show the magnitude of the
number and the actual color to show which range the number is from. Diverging
palettes are most commonly used to show the difference between positive and
negative numbers. The following is an example of what to add between the
"preferences" tags to add a diverging color palette. Note that the
"type" attribute is specified as ordered-diverging, which identifies
this palette as a diverging palette.
- In the
Preferences.tps file, between the "preferences" tags, paste the
following:
<color-palette name="My Diverging Palette"
type="ordered-diverging" >
<color>#eb912b</color>
<color>#59879b</color>
</color-palette>
<color>#eb912b</color>
<color>#59879b</color>
</color-palette>
- Save the
Preferences.tps file and then restart Tableau Desktop.
- Open the
Superstore sample data source.
- Click the Assign
Palette button. The colors in the palette are used in the order
they appear in the Preferences file.
If
you add a sequential or diverging palette, remember to change the
"type" attribute from "regular" to one of the following:
- ordered-sequential
- ordered-diverging
Step 2: Assign
a default custom palette to dimensions and measures and publish as a data
source (optional)
After
you save the workbook, the custom color palette information is embedded in the
workbook (for Excel and text file-based workbooks, in the .twbx) and therefore
only available for that workbook. This means that colors that are in use are
shown for anybody opening that particular workbook. If they don't have the
modified preferences file, they cannot use the color information for any new
color encoding. To allow new color encoding using the custom color palette or
to standardize a custom color palette for the Tableau workbooks in your
organization, you can create the custom color palette using one of the options
above, and then publish it as a Tableau Server data source.
- On the
same computer from which you modified the Preferences.tps file, open
Tableau Desktop.
- Open the
Superstore sample data source.
- Right-click
a field in the Data pane, and select Default Properties > Color.
- In the
Edit Colors dialog box, associate the field values with the custom color
palette, and then click OK when finished.
- From the
Data menu, select the data source, select Publish to Server,
and then complete process to publish the data source.
After
publishing the data source to Tableau Server, connect any new workbooks to this
data source to use the custom color palette.