Being an avid follower of stock markets and thought of creating an area graph of stocks and highlighting the lows and high of the stock for the duration selected something similar to what we see on moneycontrol.com.

My output dashboard here:

Here I will show how to use LOD (Level of Detail) expression in Tableau (More information available here)

Step 1: Downloaded stock price data using getbhavcopy app, which gives an option to extract data of all the stocks at NSE or BSE with their open, close, high, low and volume. I downloaded data from 1st Jan’17 till 22nd Feb’18 data from the app. It looked liked this:

I used command prompt commands to combine all files into one file.

Step 2: Import the data into Tableau and create area graph for the date range and applied company name and actual date as filters. For this example, I applied context filter to actual date field (using add to context filter option in Filters)

Then I created 3 calculated fields to identify High and Low price for selected duration of stock company using LOD expression named Fixed using following Nested Fixed formula:

 

Step 3: Create the worksheet with dual axis as shown below:

 

Then, I integrated the worksheet into dashboard to create output dashboard where user can select any stock with date range user wants to get output with high and lows of that duration.

Thanks!

Do subscribe to my blog to keep receiving updates on new posts

Recently, I had an requirement from my team if we can retrieve twitter data and do some visualization out of it to make some analysis. After going to through several blogs I pounced on blog from TableauJunkie on WDC on twitter and extract the data for analysis. Please look at the below dashboard I created for #TrudeauInIndia from Twitter

Following are the steps:

Step 1: Create your own Twitter API key to return the results

https://apps.twitter.com

once you create your API, twitter will provide access keys which will be used to provide search results.

For Tableau, we will need Web data connector for Twitter. I have used the web data connector shared by Alex ross on this blog Tableau Junkie:

http://tableaujunkie.com/post/119681578798/creating-a-twitter-web-data-connector

one can download the code and set up your own website or localhost to host the connector. There is also an option to modify the number of tweets count one needs.

Step 2: I used XAMP on my machine and pasted the files onto htdocs folder to host the connector on localhost.

Step 3: Start Tableau –> more –> web data connector –> enter the URL where you are hosting the files. Most probably it will be:

http://localhost/TwitterSearch/twitterwebconnect.html

Enter the hashtag or twitter account you want to search

Step 4: Go to Sheet and start creating your data visualization

Hope this will help you in future to generate twitter trends using Tableau

Recently, Tableau 10.5 was released by Tableau with Hyper technology (which Tableau says it will extract data faster and enhance query performance) and viz in tooltip which is something really exciting.

How to add viz to tooltip in Tableau:

Lets consider superstore data source for this example and import the same file into Tableau

Step 1: Create your main sheet of visualization:

For the first worksheet, we will create state wise distribution with Parameter of Sales and Profit. I have created an calculated field called option using following calculation:

Post this step I created following sheet:

Step 2: Create the visualization that you would like to see in tooltip:

Now we will create an new sheet with visualization which we would like to see when we hover over states in the main sheet. Lets say I would like to see month wise sales/profit, category wise sales/profit and top 5 sub-category sales/profit in the tooltip. Below images for reference of month wise sales:

Step 3: Add the visualization sheets into the main visualization:

Now lets go back to main visualization and add the tooltip viz into main sheet. Normally, we click on tooltip and add textual stuff or dynamic text over there to see on hover. For this, we will add the secondary sheets into tooltip as shown below:

I modified to add 2 more dashboards and it looked like this:

After adding the required tooltip viz, now if we hover over state (I did on New York) we will see the tooltip viz of month wise sales/profit, category wise sales/profit and top 5 sub-categories:

 

Additionally if you want to modify the height or width of tooltip it can be easily done by changing the maxwidth or maxheight of tableau added tooltip viz (eg: <Sheet name=”Monthwise” maxwidth=”470″ maxheight=”100″ filter=”<All Fields>”> )

Finally, data will be seen in one single dashboard rather going into different sheets or creating different dashboard to display numbers. Final dashboard which I created is shared below:

Do let me know your feedback or if you have any queries.

Thanks!!!

Today we are going see use of polygon and points in Tableau to create an map showing an geographical details. Tableau has out of the box visualization of geographic regions such as countries, zip code, states and it is pretty much simple by simple drag and drop into sheet with geocoding fields in data source.

Now, what if we need to see customize location in the map or geographical boundaries across across different suburbs or need to see municipal map of particular city with different sub-wards. Tableau for that purpose has polygons which can be used for drawing an particular spot but this required a bit of work before we start using it. This collecting of data with all the points might be time consuming process.

Lets get started with this:

Custom polygon has 2 requirements:

1 – Latitude and longitude coordinates for each point of polygon

2 – An point order in which points are connected with each other

For this dashboard, we will create Mumbai map on basis of municipality wards and I found that data from json file here and converted that into an excel spreadsheet. Once you have data arranged in below format, Tableau will connect the points with the help of longitude and latitude information:

once your data is ready with wards,points, longitude and latitude then import the data into Tableau then do following steps:

  • Place longitude and latitude on rows and columns respectively
  • change mark type to polygon
  • Convert points into dimension then place points column into path under mark
  • Final step is to place ward column into colours under mark

Your polygon map is ready for Mumbai with different Ward with its boundaries as shown below:

Next I did was to get 2011 census data of Mumbai population and create different sheets to create dashboard which shows population, literacy and working class for each ward.

Here is the final dashboard that I designed and published:

Do let me know your feedback or if you have any queries on the same.

 

I had an Tableau session last week and I came across possibility of creating hub and spoke in Tableau. I am aware of its been discussed earlier as well in multiple blogs and Tableau public but here I am sharing my experience with Hub and Spoke.

For the matter of this visualization, I extracted all the arrival data to Mumbai airport for 19th Feb from Mumbai Airport arrival website and created excel file in below format:

Each origin and destination had to duplicated into multiple records. For Example:

Flight|Origin|PathID|ArrivalTime|…

6E 189|Delhi  |Delhi – Mumbai|00:40|…

6E 189|Mumbai |Delhi – Mumbai|00:40|…

Next step was to import the data into Tableau and do the necessary data manipulation for cleaner data.

  1. Add origin to detail tab under marks section, this will enable latitude and longitude in the sheet
  2. Drag path id column into color pallette.
  3. select the number of records and put into size tab

This will create following route map (hub & Spoke model) as per below image:

Then I created couple of other sheets on the basis of on-time performance and delay types for different airlines flight arriving at Mumbai Airport and created the final dashboard showing all the details.


Let me know your feedback on the dashboard