Is it possible to dummy code a number to appear in a bar chart in Cognos? I am looking at department expense totals for 2015 and 2016 and want to put a 3rd bar for what the budget for the department is. This data is not loaded into our data warehouse though so I am searching for a possible work around.
Thanks!
If you to have one set of bars, then you have to use a union:
Create a new query
Add a new data item to hold the budget value
Add 'dummy' versions of all other columns. The data types have to match your existing query
Make sure that the order of all columns matches up with the order of the original query
Union your new query with the original query
Use the query representing the result of the union as the source for your chart
Another option you have is to use a baseline to represent the budget. Instead of a separate bar, you have a line that goes across the whole chart at the budget value. Baselines can be configured under the Chart Annotations section of the chart properties sheet.
Lastly, you can choose a chart type that accepts multiple measures.
Related
I just want to ask if its possible to filter value base on the value in a column.
I want them to show it categorized by the Tier Column, but what happening is that it shows all the data the same as each other.
On each of those four bar charts, you can set a visual level filter corresponding with the tier you want to show.
I'd like to create a combination bar/line chart and combine two data sets. I'd like the columns to be months and the rows to be the aggregate values within those months. However, I'd like one of the data sets to display as a bar chart and the other data set to display as a line chart. It should look like this:
I have the following data sets:
data_set1 = [{'value':10,'date':2016-01-01},{'value':15,'date':2016-01-02},{'value':5,'date':2016-01-03},{'value':10,'date':2016-01-04},{'value':120,'date':2016-02-01}]
data_set2 = [{'value':100,'date':2016-01-01},{'value':200,'date':2016-02-01}]
I've been able to create the bar chart (see below):
However when I try to add the values from the second data set by also adding it to the columns section, I get the following error:
"In order to use fields from dataset 2, a relationship needs to be created with dataset 1. Select Data > Edit Relationships to open the Relationships dialog box."
I tried to create a relationship between these two data sets by the following process:
Set the Primary Data Source as data_set2, since that is the smaller dataset.
Selected Custom to create a custom relationship
Selected Add and set both the 'Primary Data Source Field' and the 'Secondary Data Source Field' as Date
However,
When defining the relationship between two date type fields, try selecting the level of aggregation for the date fields, such as Month(Close_Date) in source 1 maps to Month(Date) in source 2. In effect, every value in those fields is first truncated to the beginning of the period (month in this case) before comparisons are made.
I'm using Tableau Desktop 9.0 on OSX. I have data (loaded from a local CSV file) that looks like this:
code,org,items
0212000AA,142,10
0212000AA,143,15
0313000AA,142,90
0314000AA,143,85
I want a chart that shows the number of items beginning with 0212 as a percentage of all items, for each organisation. (I mean as a percentage of the organisation's items - for example, in the above, I would like to show 0.1 (10/(10+90)) for organisation 142.)
I have been able to get part way there, by adding org to Columns, and SUM(items) to Rows. Then by adding a Wildcard filter on code, for starts with 0212.
This shows me the number of items starting with 0212, by organisation.
But what I don't know how to do is show this divided by the value of all items for the organisation.
Is this possible in Tableau, or do I need to pre-calculate it before loading my data source?
One way is to define a calculated field called matches_code_prefix as:
left(code, 4) = "0212"
You can also define a parameter called, say, code_prefix to avoid hard coding the prefix string:
left(code, 4) = code_prefix
And then show the parameter control for code_prefix to allow the user to interact with it.
If you use this new field as a dimension to separate SUM(items) according to those that match the prefix and those that don't, you can then use a quick table calculation to get the percent of total.
For example, you can place org on the Rows shelf and matches_code_prefix on the Columns shelf, and SUM(items) on the Text shelf to make a table. Then under the analysis menu, turn on grand totals for both rows and columns to see the behavior. Next, right click on SUM(items) and choose Quick Table Calc->Percent of Total. Tableau will display the percents of total in the table.
If you want the percent of total defined differently than the default, then right click on the measure again and set Compute Using to a different value such as matches_code_prefix in your case. It's usually better to set compute using to a specific field.
If you only want to display the value for the matching case, select the column header you don't want to see and choose hide. You can also turn off the grand totals from the analysis menu when you are done.
When you are confident in the values in your table, you can turn it into a bar chart for example by moving matches_code_prefix to the detail shelf and the measure to the Columns shelf.
--
The above is the drag and drop approach. If you prefer to hard code everything in a single calculated field that is calculated on the database side, you could instead define a calculation such as:
zn(sum(if matches_code_prefix then items end)) / sum(items)
Then set the default number format for that field to display as a percentage
I'm using Tableau Desktop v9.0. I have data that looks like this:
code,items
02050252,7
03040620,19
03060423,3
I want to create a bar chart of the items grouped by the first two characters of the code field.
So effectively a chart that shows this underlying data:
new_code,items
02,7
03,22
Is it possible to do this within Tableau? Or do I need to group the data manually myself first?
You can definitely do this within Tableau.
Make sure that your code column is a string. If it's not, right click on it in the dimensions section and choose Change Data Type.
Then, create a calculated field (Analysis -> Create Calculated Field) and enter the expression LEFT([Code], 2), which will take the first two characters of the code field.
Drag your new_code field to the Rows shelf and Items to the Columns shelf and voila, you have your desired data. You can of course change the type of the chart, make it a table, etc. from here.
I need help making only one (complete) Pie Chart show up when using GROUP BY in my query (SQL) using iReport 4.6.0.
I need to create a report using iReport (4.6.0; I am using the standalone version, not the NetBeans Plug-in) using data pulled from an SQL database. Basically, I'm trying to create a Pie Chart of what percentage of people in the DB are male and what percentage are female.
At first I tried doing two separate queries to extract this information:
SELECT COUNT('person_id') FROM 'table' WHERE 'SEX' = 'M';
SELECT COUNT('person_id') FROM 'table' WHERE 'SEX' = 'F';
I tried putting both of these queries into the Report Query dialog box, but iReport apparently only handles one query at a time. I also tried using UNION.
I then attempted (and am currently using):
SELECT COUNT('person_id') FROM 'table' GROUP BY 'sex'
This has given me limited success. It creates the chart that I need, but also creates additional, superfluous charts with only part of the data. It appears that each time iReport hits a new "group" from the query, it creates a new chart with the information with that group's data in addition to any data from previous groups (ie. in this case, it created 2 Pie Charts, one which showed only the female members of the DB and one which showed both male and female members). This theory was also tested by adding a new category in the DB (M, F, U) to see whether it would create 3 charts; it does (first with just female, second with male and female, third with male, female, and unknown).
The chart which interests me is the last one, the one which shows the data from all the groups. Can you guys help me in figuring out how to get only that last, complete Pie Chart?
Put the chart in the Title or the Summary band. Make sure its evaluation time is set to 'Report'.