How to sort pivot based on measure and create a stacked bar chart - visualization

I am trying to create a stacked bar chart between 2 dimensions (one being week, other is a string - more below) and 1 measure. I am new to Looker.
But in order to get the stacked bar chart I figure that I need to
Create a pivot
Transpose the data
Create stacked bar chart
I am stuck with step 2 and 3.
The above steps is what I have thought could help me arrive at the visualization I want but would appreciate if there is any other solution for this.
Scenario:
I have a digital marketing data with me, where I am trying to create a visualization on ‘Leads’ generated,
I have 2 dimensions, 1 measure
Lead Created Week - Week on which a lead was created
Reason2 - reason a lead was created or what reason attracted the user most
Leads - count of leads
I have plotted the below visualization where I have created a pivot of week with Reason2 and Lead count under it and have plotted it on a stacked bar chart (as below).
Where each bar is a Reason (X-axis) and each color is the Week dimension, leads (count of leads) is in the Y-axis
Even though this is help what would be helpful is having ‘Week’ on X-axis, ‘Leads’ (count of leads) on Y-axis and ‘Reasons2’ dimension as a legend.
There is also one catch i.e., there are more than 100 distinct values in ‘Reason2’ field but I need to pick on Top 10 Reasons (i.e., the reasons that generated the most leads), which in the above screenshot I have achieved by limiting the display rows to 10 as the measure was already sorted.
I tried to flip around the pivot by having reason in pivot and Week as dimension, but if now the pivot is sorted in alphabetical manner and not by value of measures (screenshot below), I need the top 10 reasons which most leads per week.
How do I achieve the desired visualization of having week on X-axis with leads on Yaxis but only the top 10 Reasons should be generated.

Related

Tableau Percentage calculation

I am learning Tableau using sample dataset Sample Superstore. I am trying to find out, For a given period let us say January 2012, what percentage of sales were shipped using a specific product container (e.g. Jumbo Box)
When containers are in Rows, I get 2.22% and when I flip row to column and vice-versa I get 9.17%. Would appreciate some inputs to clarify this.
2.22%
9.17%
When you use table calculation the values will differ according to the viz and what type of calculation you have used. For example table down will calculate from top to bottom and table across will calculate from left to right. Like this you will see many other options for calculations.
In below example I have used running total with table across that is direction from Left to Right column values (2014,2015,2016,2017,2018).
Example:
Image1 - Original Data(without table calculation)
Data with table calculation - running total(table across)
In below image, Left to Right values are Ship Dates against Segments. Look at the Yellow color highlighted row. Year 2015 for Consumer Segment the sales value is 40,656 but in the original data(Image1) it is 24,635. The reason it is showing 40,656 is because table calculation is performed with running total by table across(left to right), so the original value 24,635 is added with previous Year's(2014) value 16,021. Hence 16021 + 24635 = 40656. It means Left value(16021) is added with the Right value(24635). This pattern will continue till the right most value.
Image2
Columns and rows are switched
In below image(Image3) Left to Right values are Segments against Ship Dates. The Columns and rows are switched. The value of Corporate Segment for the Year 2014 is changed to 25950(blue circle) because the left side value 16021 is added with the original value 9929(Image1).
Image3

Dual Axis Chart in Tableau from different measure

I have two stack chart divided by year and the stack chart is divided by two values. I want to show percentage difference between the year among the values. I have tried using calculated field and dual axis but get stuck after adding one field. Let me attach a snapshot for more clarification. In the image I want to plot below two calculated field in the stack chart as well to show percentage difference between the year.

Tableau Gantt Waterfall Charts Bridge charts

I built a gantt waterfall chart in tableau to represent sales difference over time. I want to add columns in the beginning and end, to show the total sales before and after the sales difference occurs.
http://image.slidesharecdn.com/howtocreateatableauwaterfallchart-120307010026-phpapp02/95/how-to-create-a-tableau-waterfall-chart-9-638.jpg?cb=1376818931
You could do a dual axis to get this, with the ending total value on the second axis... *might need an LOD calc to exclude the slicing dimension for the bar on the one axis.
Or, you could create two sheets and align them side by side on a dashboard to do this.

Cognos Chart with "No Data Available" although list shows data

I am completely new to Cognos, so sorry if I don't state some necessary information. I can't go into specifics about my chart, but here is the background:
I have a SQL code running into my Query
My chart and list use the same Query and have the exact same fields
My chart is a basic line graph
When I change my aggregate function to total for my y-axis, then I can see the data points
I do not want to use an aggregate function (I need to see all the points for my x and y-axis)
My x-axis is only one object, but it has multiple y-axis values within a year (which is my series). Ex:product-cost-year list,
where my product is the x-axis, cost is the y-axis, and series is year.
How can I get my chart to appear with all my data points? Eventually, I would like to add an upper and lower confidence interval to this chart.
One way to solve this issue is to create another column that simply counts the number of products (1,2,3,...9). We will call this column count. Keep all your fields the same (product for x-axis, cost for y-axis, and year for series). You will want to add count underneath product on the x-axis. You should see your mouse pointer turn to a horizontal line and it will place it under and to the right of product. Make sure not to place it just to the right of product.

Gantt over time with summed bar

I'm having trouble creating the following chart in Tableau.
I have data that looks like this:
name date count
a 11/10/2012 2
a 12/10/2012 3
a 13/10/2012 2
b 12/10/2012 6
b 13/10/2012 2
b 14/10/2012 3
c 14/10/2012 2
c 15/10/2012 2
And I want to create a bar chart that has the sum of the count on the y axis and time on the x axis. The width of the bar should be the length of the time, like a Gantt chart. Each name has its own bar. Here is an image that shows what I am after.
The bars should overlap if the times overlap.
I have tried various things in Tableau but haven't really got close.
Is this kind of chart possible in Tableau? If not in 7, will it be in 8? I have heard it makes it possible to create some more complex chart types.
A workbook with data can be found at http://community.tableausoftware.com/servlet/JiveServlet/download/188799-12362/Gantt%20over%20time%20with%20summed%20bar.twbx.zip
Thanks for your help,
Andrew
The trick with Gantt charts in Tableau is to put a calculation on the size shelf that calculates the duration of each bar in units of days. See the example screenshot at Tableau example
You also need a continuous date field on the columns shelf to get a horizontal time axis.
In this example, I also did a few more optional things, such as, turned off aggegation under the analysis menu to get a mark per data row, rather than aggegating them, added a discrete date to the rows shelf to make each bar go on a different line (as long as each bar starts on a different date) and hid the column for that start date.