slice chart bar into two in cognos - charts

I need assistance on Chart in Series (primary axis), I need to create a condition that will slice the chart bar into two separate bars based on the measure condition
It can be a filter or tuple or calculation. I will have to create two bars: one when the measure is negative and the other when the measure is positive ('Overdue' and 'Pending')
The chart is based on Cube.
Dimension: Action (Source: 'Action Code', Label: 'Action Desc')
The measure: 'Days Between' which is the number of days between the Action date and current date.
Example: for the Medical Action, I need to separate it in 'Overdue' and 'Pending'

Your question is rather generic so the answer will be the same. Birt data sets enables both filtering and adding computed columns. You need to specify only what you want to filer and how you want to calculate it.
Then create simple chart displaying filtered/calculated data.

Related

How to incorporate two filters on the same field for a comparison chart

I would like to be able to add two filters on the same field in order to plot a comparison of values for two bands.
What is the way to proceed?
Ultimately I would like to generate the figure from the table below, by being able to dynamically select A/B bands from two different filters. In this case, Filter1=A and Filter2= C were selected to compute Filter1-Filter2 across the dimension 'Type'.
I have tried duplicating the filter but when choosing a band, it affects both filters.
The way to do this is with two Parameters. Each should have its values generated from the field (in your case, A/B). The create a single filter (calculated field) that says "[parameter1]=[field A/B] or [parameter2]=[field A/B]". Put the filter on the filter shelf and set it to true.
Now you have two "filters" (parameters) that can both drive the single field.

How to apply a filter to only one column? The columns differ by a value of the same binary filter

I have visualizations that have bar graphs set up in 6 separate sheets. These bar graphs need to go side by side for comparison. 2 graphs will be combined to form one side-by-side graph. They only differ by a filter that is set to either 0 or 1 in the corresponding sheets. Everything else is the same.
Example:
In sheet 1, XMJ is filtered by Misdemeanor = 0
In sheet 2, XMJ is filtered by Misdemeanor = 1
I'd like to make them show side-by-side for comparison.
I have already tried duplicating XMJ and bringing it side-by-side but couldn't apply Misdemeanor = 1 or 0 separately to the duplicate column.
Here is the file: Visualz
You can accomplish this with a table calc filter.
Create a calculation lookup(min([Misdemeanor]),0) and put it on your filter shelf in each sheet and you can filter them independently.
Table calcs happen after the data is displayed on the viz (see Order of Operations).
The min([Misdemeanor]) part tells Tableau you want to look at the minimum value (this could be also max/attr/sum it wouldn't matter in your case).
The lookup(measure,0) tells Tableau to look at the current row of the measure (but again, after the data is already on the table). At this point, you can filter it independently.
EDIT: Another thought is you might just have the filters set to All Using this Datasource or (multiple) selected sheets. You can change this behavior in either the worksheet (1st picture) or dashboard (2nd worksheet).

Get average value of each (Sub) column

i would like to calculate the average of values of each "main" column, as shown in the picture (named as bundling column). Each bundling(main) column has 1 to N "sub columns" (which are values for a certain datetime). The bundling itself is variable, it changes for different filters.
How can i reference to these sub columns to get the sum/count and average of these? I thought of using the "Window average" function but i don't have an idea how to define the start/end offset parameters. Not sure if window average is the correct option.
Thank you very much
A level of detail (LOD) calculation will allow you to control at what level the aggregation occurs.
{INCLUDE [Agg(Bundling)]: AVG([Agg(Error Select)]}

Tableau: Plot percentage of binary column

Simplified example: column of 'measure' data is binary 0's and 1's. The sum of the column (all the 1's summed) is 3948. The length of the column is 4567. 3948 is 86% of 4567. How do I create a bar chart showing this percentage. All I can get is a bar adding up to 100%.
I've tried absolutely everything in the percentage of dropdown, calculated fields, online tutorials, etc.
Two approaches:
Right click on your measure field on whichever shelf you placed it. Choose Quick Table Calc -> Percentage of Total. Experiment with different settings for "Compute Using" and read about addressing and partitioning of table calculations to learn how to specify percent of "what".
Or create a calculated field specific to your problem defined as below:
sum(int([my measure field] = 1)) / count(1)
Be sure to set the default number format for your calculated field to a percentage, by right clicking on it in the data pane (left margin) and revising the default properties
Note, the second calculation works because the INT() function converts True to 1 and False to 0, which is useful in several contexts.
You can go about this using the following method
Add 'measure' to Columns and make it a Discrete Dimension
Add SUM(Number of Records) to Rows. This should give you the bar chart you need.
This would help achieve what you are looking to do. For more customization and a better look for the graph you are looking to build in Tableau.
Add 'measure' to the colour legend and make it a Discrete Dimension.
Add SUM(Number of Records) as a Label and do a '% of Total' quick table calculation.

Creating a "stacked" Gantt chart in Tableau?

I'm working with a dataset that describes contract durations with a list of companies. Obviously all contracts have a start date and a (minimum) duration. Some contracts however, are subject to possible prolongation. Here's a data example:
Company contractStart minDuration firstProlong secProlong
Company x 27-11-2011 27-11-2014 27-11-2015 27-11-2016
Company y 29-11-2014 29-11-2015
Company z 01-04-2011 01-12-2011 01-12-2015 01-12-2017
I want to visualize them in a Gantt'ish type diagram that has duration along the x-axis, and shows the respective contract lengths with the possible prolongations as a sort of stacked bar chart. Along with that I want something to mark the current date. I've managed to do this in Excel. See picture:
.
I would however really like to be able to the same thing in Tableau, and I really can't figure out how to. I've been working with two different approaches so far:
1st approach
Here I drag the Company to the Rows shelf, and the contractStart date to the Columns shelf. I then create a calculated field that calculates (with DATEDIFF) the difference in days between the contract start and the minimum duration. I can drag that to the Size shelf, set the mark type to Gantt bar, and get something like this:
I can then go on to calculate the date difference between the minimum duration and the 1st prolongation and the same for the 1st and 2nd duration. The problem here is that I can't add these calculated fields to the Size shelf as it can only hold one at a time.
2nd approach
Here i reorganize my data like this:
Company Type startDate endDate
Company x minDuration 27-11-2011 27-11-2014
Company x firstProlong 27-11-2014 27-11-2015
Company x secProlong 27-11-2015 27-11-2016
Company y minDuration 29-11-2014 29-11-2015
Company y firstProlong
Company y secProlong
Company z minDuration 01-04-2011 01-12-2011
Company z firstProlong 01-12-2011 01-12-2015
Company z secProlong 01-12-2015 01-12-2015
I then create a calculated field to find the difference in days between startDate and endDate. I drag that to the Columns shelf and drag Company to the Rows shelf. I then drag Type to the Color shelf, set the mark type to Bar, and get something like this:
The problem here is that I need dates along the x-axis not integers. Also I need to be able to sort the chart like my initial Excel example. I.e. I want to sort on the longest possible duration of a contract (ascending). Also having to reorganize all my data seems a bit tidious.
Here's the spreadsheet and the tableau file I've been working with. Am I overlooking something really simple?
Your approach 2 is close. instead of sum(datediff) on the columns, place StartDate as continuous. Then place sum(datediff) on size. You can now sort Company ascending on sum(datediff). Sometimes, reorganizing data is necessary.