Add a Reference Line

reference line tableau data science

I have just enrolled in a Data Science course on Udemy  and I learned good stuff.

In the previous article we learned how to work with aliases. We will learn how to add a reference line in our bar chart.

Before I start, I’ll show you a trick in Tableau.

In our bar chart we can see the labels in this order : percentage and below : « Stayed » or « Exited ».

We will reverse this order. You go in this rectangle.

reference line tableau data science

And you place the label « Exited » above the label « SUM(Number of Records ».

reference line tableau data science

Look, the label « Stayed » is above percentage.

reference line tableau data science

With that, we can understand the bar chart more easily.

Let’s add a reference line, let’s go . But before, I think you’d like to know why I’m talking to you about a reference line.

A reference line helps us to compare bar chart results with a benchmark. This benchmark is represented by this reference line.

In our case, the benchmark is the percentage of clients who left the bank in our sample of 10 000 people.

The first thing to do is find this percentage in our bar chart. To be able to do that, remove « Gender » from « Columns ».

reference line tableau data science

Boom, we have a new bar chart.

reference line tableau data science

Look, we only have the percentage of clients who left the bank and the percentage of clients who stayed in the bank.

We see that on our sample of 10 000 people, there are 20% of the clients who left the bank and 80% of the clients stayed in the bank. This means that the churn rate (client departure rate) is 20%.

What we’re going to do is we will add this churn rate in our A/B test. To return to our A/B test, press 2 times on Ctrl+Z or Command+Z or you can click 2 times on the « Back » button in the menu bar.

reference line tableau data science

Now we know that the average clients who left the bank is 20%.

We will add a horizontal line in the Y axis (Y = 20%) to compare the 20% of the churn rate and the 2 categories male and female.

Let’s go. Right-click on the vertical axis (Y axis) and select « Add Reference Line ».

reference line tableau data science

A window appears with several options.

reference line tableau data science

You have the choice to add a line, a band, a distribution or a box plot.

We will use the line for the entire table.

Click on the « Line » button and activate the « Entire Table » checkbox. In « Value » selects « Constant ».

reference line tableau data science

The constant is 20%, so it’s necessary that you put 0.20 in « Value ».

reference line tableau data science

It’s possible to put a label on this reference line. For example, if the line reference corresponds to a formula, the label displays the formula. But for our case, our constant is 20% and it’s already displayed on the vertical axis so we will select « None ».

reference line tableau data science

For the format of the line, select the continuous line and click on the « OK » button.

reference line tableau data science

We have our reference line is added to our chart.

reference line tableau data science

Here is what we can see. Female clients are more likely to leave the bank than average clients. Male clients are less likely to leave the bank than average clients. 

In our case, it’s obvious to see that because there is only 2 categories, men and women.

Now you know how to add a reference line in a bar chart.

Share this article if you think it can help someone you know. Thank you.

-Steph

Please follow, like and share:

Label And Format

 data science tableau label format

I have just enrolled in a Data Science course on Udemy  and I learned good stuff.

Our bar chart has colors by region but imagines that this bar chart is on a wall of an open space or in a report.

With labels, we can make this bar chart more clear, easier to understand.

In this bar chart, there are all necessary information: representative’s names, regions where representatives make sales and total sales for each representative in Swiss francs.

But, there is a problem. For example, if you ask for someone to say how many sales made Bill. This person must find Bill and see on the vertical axis to the left the value. Here we can see, it’s 1750.

But if we take the James case, we see that it’s between 1000 and 1500. James is far from the vertical axis and it’s difficult to say the true value.

That’s means, all people need to make effort to extract the bar chart’s information.

This it should not be the case because a Data Scientist searches always the best ways to communicate the information. This process is to help people to understand and extract the information in the easiest way.

Start with labels.

« Labels » button allows you to add text information in your bar chart.

data science tableau label format

You will add a label with the SUM(TotalSales) information

To do this, you click on SUM(TotalSales) and press and maintain the key Ctrl or Command on your keyboard and drag and drop SUM(TotalSales) on « Label ».

data science tableau label format

Now you can see the total sales value at the top of each bar.

data science tableau label format

The bar chart is easier to read because there is the total value of sales for each representative.

it’s time to add more information using the labels.

Use the « Rep » information. Click on « Rep », press and hold « Ctrl » key or Command key on your keyboard and drag and drop « Rep » to « Label ».

data science tableau label format

Now you can read the representatives names at the top of the bars.

data science tableau label format

You can also add the region. I’ll show you another way to add « Region » in « Labels ». Click « Region » in « Dimensions » and drag and drop « Region » on « Labels ».

data science tableau label format data science tableau label format

 

But it’s redundant because you can read the representatives names below and the regions at the top of the bar chart.

And each region has its own color. As it’s redundant, we remove « Rep » and « Region » from « Labels » by dragging and dropping out.

data science tableau label format data science tableau label format

 

It’s better, it remains only SUM(TotalSales).

data science tableau label format

Let’s go to the next level, we will publish our labels.

To do this, do a right-click on « Labels » and click on « … » button.

data science tableau label format

It allows you to have your own text. For example write « Sales : » and click on « OK » button.

data science tableau label format

Now you can see that your text appears at the top of the bars.

data science tableau label format

Well, click on « Labels » and click on « … » button.

data science tableau label format

Delete the text « Sale : »and click on « OK » button.

data science tableau label format

We will see now how to format your bar chart. This is the last step before your bar chart is in production.

You will change the labels size. Click on « Labels » and click on « Font »

data science tableau label format

Select « 12 » and bold.

data science tableau label format

Oh, you can do the same thing by clicking on « … » button

data science tableau label format

You have the possibility to change the color but we will keep the color black

data science tableau label format

Now you’re going to change the label type. Right-click on SUM(TotalSales) and click on « Format… ».

data science tableau label format

In fact the labels have their own format and you can change that by clicking on « Label » but all the other thing on Tableau give their format options make a right-click on it.

So when you click on « Format », you’ll see 2 tabs : « Axis » and « Pane ».

Select the tab « Pane » because that’s where the labels of our bar chart.

data science tableau label format

By clicking on « Alignement », you can change the text’s direction of the labels.

data science tableau label format

But what you can’t do with the « Labels » button is to change the digital type.

data science tableau label format

Return on the tab « Pane », we’ll change the numbers in currencies. Click « Numbers » and select « Currency(custom) ». You can also change the currency type in the « Prefix/suffix ».

data science tableau label format

To simplify, you delete 2 decimals in « Decimal Places ».

data science tableau label format

As you can see on my bar chart, the SUM(TotalSales) is vertical at the top of each bar. To change the direction of the label text, click « Alignement » in the « Pane » tab.

data science tableau label format

But there is a problem. Some bars don’t have SUM(TotalSales). To fix this, right-click on each bar and select « Mark Label » and « Alwlays Show ».

data science tableau label format

Now, the bar chart is more understandable.

Let’s put the units in thousands. Click on « Numbers » => « Currency(custom) » => « Units » => « Thousands (K) ».

data science tableau label format

Add a decimal in « Decimal Places ».

data science tableau label format

That’s better, we can see Swiss francs sales for each sales representative.

Look, there’s something you need to know You can’t change the size of the text in the tab « Pane ».

If you click on « Font » and change the size, it will not change anything on your bar chart.

data science tableau label format

This is because the font size in the « Label » button dominates the font that is in the tab « Pane ».

data science tableau label format

Ok, we changed the labels format. Now, let’s change the axes format.

To do this, right-click on the vertical axis and select « Format ».

data science tableau label format

Click on the « Axis » tab and change the text size with « Font » to 12.

data science tableau label format

Then, right-click on the horizontal axis. Selects « Format ».

data science tableau label format

And in the « Header » tab, you change the text size with « Font » to 12.

data science tableau label format

Oooh, do you see ? Mathiew is cut off. To arrange this, enlarge the bar chart by clicking and dragging on the right.

data science tableau label format

Right-click on « Central » in the top axis and select « Format ».

data science tableau label format

And changes the text’s size with « Font » to 12 and bold.

data science tableau label format

Now, look at the top of the bar chart. The « Region/Rep » line is useless because we know that Central, East and West are the regions and the representatives names are at the bottom of the bar chart.

data science tableau label format

To change it, right-click on « Region/Rep » and select « Hide Field Label for Columns ».

data science tableau label format

if you want to improve the title « TotalSales » by adding a space, right-click on the vertical axis and select « Edit axis ».

data science tableau label format

In the « General » tab, add a space in the title and click « OK ».

data science tableau label format

Let’s do one more thing. We’re going to put all the « Total Sales » in Swiss francs. Make a right-click on the vertical axis and select « Format ».

data science tableau label format

Click on tab « Axis » => « Numbers » => « Currency(custom) ».

In « Decimal Places », you put « 0 ». In « Units », you put « Thousand(K) ». In « Prefix/Suffix », you put « CHF ».

data science tableau label format

Well, you did a good job. Now you know how to change the format of the charts in Tableau.

Share this article if you think it can help someone you know. Thank you.

-Steph

Please follow, like and share:

Masturbation And Sport

hand draw

I watched a Jamcore DZ’s video  and I learned good stuff.

My intention is to explain masturbation’s effect on a sport activity without being vulgar. Masturbation is a normal activity for some people and abnormal for others. In some religions, it’s a forbidden or ignoble activity but it’s an activity that most people do.

Type of person

type person

The open minded person

For this person, masturbation is a normal activity because it’s natural and give a good mood. It’s not something bad.

The guilty person

For this person, masturbation is an abnormal activity, ignoble but despite that, this person does it and still feels guilty after masturbation.

The obsessed person

For this person, masturbation is an obsessive activity. This person could masturbate every hour, every day.

The bored person

For this person, masturbation is an activity to kill boredom. He’s a person who has nothing to do in life or in the day and doesn’t know what to do, masturbation.

How the body reacts

body reaction

chart masturbation dopamine orgasm prolactin testosterone

  1. The intensity of masturbation increases (black line)

  2. There is a release of hormones, it’s dopamine. Before masturbation, there is a first release of dopamine that cause sexual arousal and there are other dopamine release during masturbation (blue line)

  3. Sexual arousal during masturbation will start the process to have the explosion, this explosion is orgasm (red line).

  4. Once the orgasm has happened, there is a release of hormones, it’s prolactin. Prolactin causes the loss of interest to continue masturbation. You satisfied and you don’t want to continue to masturbate. In some situation, prolactin can make you feel guilty (green line).

Stop masturbation for 1-3 weeks

stop

chart masturbation dopamine orgasm prolactin testosterone

There is a black line in the middle of the chart. This is the line of testosterone. When you stop masturbation for 1-3 weeks, there is an increase in testosterone rate. But after 3 weeks, the testosterone rate returns to normal. You have to base on your normal testosterone rate to see if your testosterone is affected by anything.

It’s possible that during masturbation, the testosterone rate is below your normal testosterone rate. In this case, it’s another problem and it’s necessary to see your doctor for more details.

Most people think that masturbation makes you lose testosterone. So if masturbation makes you lose testosterone, it means that masturbation also make you lose muscles. The truth is that this myth is wrong.

Masturbation and gain muscle

anatomy muscle

The answer is « No » because the elements that influence muscle gain are training program, nutrition and rest/sleep. The only thing that masturbation does before or after a training session is the increase in heart rate.

Warning

Now that you have this information, it doesn’t mean that I encourage you to masturbation several times a day, every day. You do this when you want according to your desires but in moderation.

Here are several scientific studies on masturbation and testosterone :

  • Endocrine response to masturbation-induced orgasm in healthy men following a 3-week sexual abstinence. Click here . 
  • 3 Weird but Surprisingly Effective Tricks & Tips to Raise Natural Testosterone Levels. Click here
  • Lack of sexual activity from erectile dysfunction is associated with a reversible reduction in serum testosterone. Click here.
  • Studies on the relationship between plasma testosterone levels and human sexual activity. Click here
  • Acute changes in plasma testosterone levels and their relation to measures of sexual behavior in the male house mouse (Mus musculus). Click here
  • Effects of ejaculation on levels of testosterone, cortisol, and luteinizing hormone in peripheral plasma of rhesus monkeys. Click here
  • Relationship between sexual satiety and brain androgen receptors. Click here .
  • Increased estrogen receptor alpha immunoreactivity in the forebrain of sexually satiated rats. Click here
  • A study of the prostate, androgens and sexual activity of male rats. Click here
  • Androgen Receptors: 5 Ways to Increase the Density and Sensitivity of the AR. Click here
  • Scientists visit sex club for research into testosterone levels. Click here
  • Male and female salivary testosterone concentrations before and after sexual activity. Click here
  • Sex and Testosterone: Most Enjoyable Way to Boost Male T-Levels Naturally. Click here

Share this article if you think it can help someone you know. Thank you.

-Steph

Please follow, like and share:

Add Color

colors

I have just enrolled in a Data Science course on Udemy and I learned good stuff.

Podcast:

In the last article, we created our calculated field « TotalSales » that you can see in «Measure » zone.

In Tableau, the calculated field is very used (almost every time) because in most case the data don’t give the value you want to show.

The calculated field « TotalSales » is a simple example to make you understand how it works but know that you can do things more complex. I’ll show you that later.

In this article, I’ll show you how to manipulate colors because it’s an important element to communicate. With colors, people will understand more quickly what you want to explain to them.

Imagine that you have to show this bar chart to the manager who handles the bonuses. By putting a little color, a little art, you could improve the reading of this bar chart.

To use colors, click on this button.

data science tableau color

You can change the color with the basic colors.

data science tableau color

Or you can have more colors by clicking here.

data science tableau color

If you have a picture in the background, you have the possibility to change the opacity to have a transparent effect of colors.

data science tableau color

You can add a border, change the border’s color, etc.

data science tableau color

But what would be nice to do is to have bars with different colors.

To start, take « Rep » and move it on « Colors ».

data science tableau color

With this, there is a unique color for each representative.

data science tableau color

There is also another method to do that. Instead of taking « Rep » and moving it to « Color », you can click « Rep » here.

data science tableau color

If you move it to « Colors », you’ll break everything because « Rep » will no longer be in the « Columns » zone.

data science tableau color

To avoid this, press Ctrl or Command on your keyboard and click « Rep » to make appear the sign « + ». Now that you made a copy of « Rep », move it to « Colors ». It’s like making a copy/paste from « Rep » to « Colors ».

data science tableau color data science tableau color

With this method, « Rep » is always in the « Columns » zone. This is a method that is very practical when there are many dimensions.

It’s possible to change representative’s colors by clicking here.

data science tableau color

As you can see, there are several choices of palettes.

data science tableau color

You can test the « color blind » palette which is very useful for color blind people. To select this palette, click « Assign Palette » and « Apply ».

When a palette has fewer colors than representatives, you will have a message saying that some colors will be duplicated. But this is not a problem because there are names below the bars.

data science tableau color

Now we want to see something else with our bar chart. Press “Ctrl” or “Command” on your keyboard and click on SUM(TotalSales) to display the « + » sign. Then move SUM(TotalSales) to « Colors » to replace « Rep ».

data science tableau color data science tableau color

As you can see SUM(TotalSales) has different colors. The colors are on a continuous basis which means that the more sales there are, the darker the color.

For our case, this is not useful because the size of the bars represents the sales number but for other situations, this is useful.

The problem now is that there are duplicate colors and because of this, the Manager could misinterpret the results. An alternative approach would be to ensure that the Manager understands the results.

The solution is to take « Region » (by pressing “Ctrl” or “Command” on your keyboard) and move it to « Colors ».

data science tableau color

You can also take « Region » (with “Ctrl” or “Command”) and move it to SUM(TotalSales) to replace SUM(TotalSales).

data science tableau color

With that, the bars are colored by region.

data science tableau color

That way, you can clearly see the 3 regions through colors that are unique to each region and you can see the total sales per representatives with the size of the bar.

This is a small example so that you can understand the basics to manipulate colors in Tableau. There are still more complex techniques to manage the colors that I will show you later.

Plays with the colors so you can fully understand how it works. You could find your favorite palette and find your style. Have fun.

Share this article if you think it can help someone you know. Thank you.

-Steph

Please follow, like and share:

Create A Calculated Field

data science tableau calculated field

I have just enrolled in a Data Science course on Udemy  and I learned good stuff.

Now is the time to solve the problem of who is winning the bonus.

The first thing to do is clean the dashboard. To do this, click on the « Clear Sheet » button.

data science tableau calculated field

To start we need to create a « Bar Chart » to see the salesperson. In this data, salesperson named « Rep » for representatives.

data science tableau calculated field

To see how many items were sold by each sales representative, you need to put « Rep » in « Columns » and « Units » in « Rows ».

data science tableau calculated field

You can see that the representative who sold the most is Richard.

But we want to have more details. We need to know who is the best representative by region and for now, we can’t see that.

To see this, you put « Region » in « Columns » before « Rep ».

data science tableau calculated field

As you can see, the « Bar Chart » changed. There are separations by region.

In each region, you can see the representatives and the number of items they sold. Alex is the best in Central. Richard is the best in the East and James is the best in West.

To get better visibility, you can order the bars in descending order. Move the mouse over the label « Units » of the bar chart and an icon will apprear. Click on it and the bars will be sorted in descending order.

data science tableau calculated field

Unfortunately, we didn’t answer the question because « Units » is only the number of items sold. What interests us is the amount of money earned by selling the product but we don’t have this type of measure. There is no measure that shows us the total value of sales. There are only « Units » and « Units Price ».

In this case, you have to make a calculation to have the total sales in cash. For each representative, you need to multiply « Units » with « Units Price ».

Let’s look at the data to make a test calculation. Right-click on the « OfficeSupplies » data and click on « View Data ». For example, you see that Nick sold 29 binders to $1.99. So 29 (Units) multiplied by 1.99 (Unit Price) equals $57.71 for this sale.

data science tableau calculated field data science tableau calculated field

In our data, we have no measure where « Units » is multiplied by « Units Price ».

data science tableau calculated field

To solve this problem, you will create an additional measure with a « Calculated Field ». « Calculated Field » si an element that allows us to create measures by calculating quantities.

To create this, right-click in the « Measure » zone and select « Create calculated field… ».

data science tableau calculated field

You can name the calcultated field « TotalSales »

data science tableau calculated field

Select « Units » uses the « * » sign to multiply and select « Unit Price » and click « OK ».

data science tableau calculated field data science tableau calculated field

Now, you can see that your measure « TotalSales » in the « Measure » zone.

data science tableau calculated field

By looking good, you can see that there is an « = » sign before the « # ». This is to indicate that this measure is a calculated field.

Ok, the measure is ready, let’s go. Put « TotalSales » on « Units » to replace « Units » with « TotalSales. Tableau automatically takes the sum aggregate.

data science tableau calculated field

If you want to do this more cleanly, you can remove « Units » by dragging it outside « Rows », then take « TotalSales » and put it in « Rows ».

data science tableau calculated field data science tableau calculated field

Now, that we have a « Bar Chart » with data from « TotalSales », we sort the bars in descending order by clicking here.

data science tableau calculated field data science tableau calculated field

As you can see, the results are different because Richard is no longer the best representatives in the East, it’s Suzanne. The best representative in the East is Suzanne, the best representative at the Center is Mathiew and the best representative in the West is still James.

it’s with the calculated field « TotalSales » that we can know who are the best representatives by region so Suzanne, Mathiew and James earn a bonus.

This was an example to learn how to create a calculated field in Tableau. Have fun creating new calculated field to master this tool that is really useful.

Share this article if you think it can help someone you know. Thank you.

-Steph

Please follow, like and share:

Navigate In Tableau

front boat

I have just enrolled in a Data Science course on Udemy  and I learned good stuff.

We’ll explore Tableau’s tools

From the connection manager, we’ll go into the Tableau’s workspace.

Click on the « Sheet1 » tab at the bottom of the window.

data science tableau screenshot

Here is the Tableau’s workspace.

data science tableau screenshot

The 2 important elements of the workspace are « Data » on the left and the workspace on the right. It’s in the workspace that you’ll create tables and charts.

We’ll start with « Data » on the left.

data science tableau screenshot

« Data » divided into 2 zones : dimensions and measures.

The dimensions and measures are 2 different rules that will allow you to manipulate data.

Tableau sets the numerical values in « measures » and the categorical or quantitative variables in « dimension ». This is the Tableau’s settings by default.

There is also another way to explain « dimension » and « measures ». The « dimensions » are independent variables and the « measures » are dependent variables.

For exemple, « Units » is a measure, it’s the number of items sold per product. « Region » is a dimension, it’s the geographic region where the product sold. With 2 elements we can know how many items sold by region. This means that « Region » is an independent variable and « Units » is a dependent variable because it will be grouped by region.

But if you don’t like it, you can move the entities between dimension and measures and the opposite by click and drag.

In the menu bar, at the top, there is « File » where you can open and save file.

data science tableau screenshot

« Data » to connect to new source files.

data science tableau screenshot

« Worksheet » is the workspace to create analyzes

data science tableau screenshot

« Dashboard » is a combination of worksheet

data science tableau screenshot

« Story » is a combination of worksheet and dashboard

data science tableau screenshot

« Analysis » to specify how you want to do your analysis on your workspace

data science tableau screenshot

« Map » to add maps to the workspace

data science tableau screenshot

« Format » contains formatting options

data science tableau screenshot

Now, let’s study the workspace.

In the workspace, the main elements are « Columns » and « Rows ». This is where you decide which data goes in columns and rows in your worksheet.

You can also choose different format for these elements like colors, size, text level of detail and tooltips (useful tool optional).

data science tableau screenshot

Let’s do a test. Use data from « Region » (which is in « dimension »). Move « Region » with a click and drop to the center of your workspace. Now, « Region » is in the element « Rows ».

A table appears in your workspace.

data science tableau screenshot

You put a dimension in your workspace. Now put a measure in your workspace.

Uses the « Units » data. Move « Units » with a click and drop next to the « Region » column.

data science tableau screenshot

As you can see, Tableau automatically put « Region » in the « Rows » element and the « Units » data aggregated by region. In this way, you can tell how many items were sold by region.

Now, what you can do is to move « SUM(Units) » to the « Columns » element.

data science tableau screenshot data science tableau screenshot

And then, you have a « bar chart » to see how many items have been sold by region. You can enlarge the graphic with a click and drop.

Let’s look at the tools that are in « Show Me » zone.

data science tableau screenshot

Click on « Pie chart » to have this chart’s type.

data science tableau screenshot

Click on « Size » icon and drag from left to right you can increase the chart’s size.

data science tableau screenshot

In this chart, each region has a color and proportion of items sold by region.

You can also test the « bubble chart ». Tableau organizes the data automatically and everything and placed in the « Marks ».

data science tableau screenshot

You can test « Treemaps » chart. This is the same principle as « bubble chart » but it’s rectangles instead of circles.

data science tableau screenshot

As you can see in « Show Me », there are charts disabled. This is because you need some elelments in your data to be able to activate them.

For example for the « Area chart », you need « date »data to activate it.

Share this article if you think it can help someone you know. Thank you.

-Steph

Please follow, like and share: