Join two data sets by year in Tableau [closed] - tableau-api

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have two datasets which looks like:
# 2013_data.tsv
year state age
2013 CA 22,5
2013 OH 19,3
2013 IL 45,5
2013 TX 33
# 2012_data.tsv
year state age
2012 CA 23
2012 OH 21,5
2012 CA 44,3
2012 TX 34,4
I want to use year as a pager on the Tableau map.
How can I join this separate data sources?

You could blend on year, but if the year is always different in each data source then the blend will not match on anything and you will get no results.
I am guessing that each data source (tsv file) has the same format (same number of columns and column names). In that case you can extract each data source with tableau desktop and then add the data from each source to get a master extract. (you are basically appending the data extracts):
and you will get all the data in one extract:
from here it is simple to combine the years in one visualization.
Also, since this is SO, I will point out that you can do this programatically with the extract API (see https://www.tableau.com/learn/tutorials/on-demand/extract-api-introduction).

Your best approach in this case is to put all the data into one table before using tableau. (It looks like what you really want is a union instead of a join)
Another approach is to put two tables in the same database, or two tabs on the same spreadsheet,and use custom SQL to union all them together. Or you can append multiple tables into a single Tableau extract as emh described.
If you are conceptually joining tables instead of unioning them, you could also use data blending.

Related

Matlab data pull and save [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
What I'm attempting to do is simple:
Given an excel dataset and user defined inputs, open the associated excel file, pull the associated information for the user inputted information and save this information in a separate excel file.
I've already developed a list of values and the program recognizes user input with associated checks. I'm stuck on getting Matlab to use this information to open the correct dataset, I don't know how to get Matlab to pull a row/column in excel with a silent open and I don't know how to get it to save that data into a separate excel file. Any help would be appreciated, thank you.
Consider using the functions readtable, and writetable if you have a recent MATLAB (anything more recent than R2013b). The readtable function will 'silently' read data from a specific worksheet in an Excel file into a MATLAB table variable. From there you can 'query' the table to find the specific rows you want and write the result to a new excel table with writetable.
Using readtable, you can specify the range of data with the parameters sheet and range.
requested_data = readtable(excel_file, ...
'sheet',input_sheet_name, ...
'range',input_data_range);
and write the data to another Excel file with
writetable(requested_data,ouput_excel_file, ...
'sheet',output_sheet_name, ...
'range',output_data_range);
Note: Remember to set the values for excel_file, input_sheet_name, input_data_range, output_excel_file, output_sheet_name, and output_data_range before running above commands.
Querying the table to access data in your table. One way would be to use ismember as in this answer.
Finally, use writetable to store the values.
See also: sheetnames, detectImportOptions, and SpreadsheetImportOptions

Column to Row transpose in Talend [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I want to get a crosstable operation by using Talend Open studio.
My Source is like:
id 201601 201602 201603 ...
1 aa bb cc ...
I want to get the output like below:
id date value
1 201601 aa
1 201602 bb
1 201603 cc
. . .
. . .
. . .
Column name is depend on date. So I need a automatic way to convert columns into rows.
You may use tSplitRow.
See the capture with the job, tSplitRow configura and schema.
I think you can try with tUnpivotRow component. However you need to know this is custom component created by community member daztop.
Component is avalaible to download from this link.
Under this link you will find instruction how to use this component.
Also if your data are stored in database you can transpose columns to rows direclty in that database by running proper sql query via talend (query depends from databse engine).

Find Last 5 columns of a table [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Is there a way to find the values of last 5 columns of a table?
Suppose if i have a table of 20 columns, i want to select all the values from the last 5 columns.
Any help will be appreciated. Thanks in advance.
Don't. It's stupid.
There shouldn't really be any order to the columns - they should just have names. It's just a convenience when testing or sitting at a DB console that SELECT * gives you them all.
There are very few cases where SELECT * makes sense in a live system. I can't think of any where you want whatever columns happen to be "last" on a table.
If you are really committed to doing this then you'll have to query the information-schema or system catalogues. Get a list of the columns on a particular table and then build your SQL to query them.
However, if you aren't in control of this table then it's a meaningless task since you won't know what the information means. If you are in control of the table then you know what column-names there are and that's a better way to do it.
Seems simple enough unless I misunderstood.
Select col16, col17, col18, col19, col20
From yourtable
i got the answer
SELECT column_name
FROM information_schema.columns
WHERE table_name='your_table'
order by ordinal_position
From ordinal_position we can get last 'n' columns we want.
Thanks for all the answers.

Crystal report multiple date count

I am trying to create a crystal report chart that counts the number of opened and closed tickets of each month.
Example they opened 10 tickets but 15 were close (7 from the same month 8 from other months).
When I try to generate the report I can get either the open or the closed working. I know the problem is with the grouping (if grouped by the submitted date the submitted date is right but the closed is wrong because of ones from other months and vis-a-versa).
I have tried overlapping the reports but the problem with that is the auto scale could be different for the reports and fixed scaling is not an option.
Because the data is filtered to return all rows with a submitted date or a closed date is greater than one year ago. I use a sum to count the records
example:
if submitted > 1 year ago
1
else
0
same for closed
For the display I need a bar chart where the two groups are sorted by the month. One bar for the ones opened in that month and one bar for the closed of that month.
Similar situation but I can't modify the sql.
One record in multiple Groups within Crystal Reports XI
I'll offer my solution based on years of wrestling with Crystal.
Do your data processing in the database (stored procedures) or core application (C# or whatever), then hand off a simple table or two to Crystal.
This makes your reports lightweight and easy to maintain (or move to another reporting tool later on) and puts the "guts" of your logic in plain code that can be managed in source control.
I'm sure you could get it to work in Crystal, but next month you will forget how it works and your coworkers will be even worse off. Let Crystal do basic formatting and render a pretty report, but do the hardcore data processing elsewhere.
Spend an hour feeding Crystal simple data rather than spending an hour configuring 5-level-deep options in the Crystal designer.

Dynamic Columns [duplicate]

This question already has answers here:
How to show/hide a column at runtime?
(8 answers)
Closed 5 years ago.
I need to create a report where the number of columns changes based on the data being passed to iReport just like with a subreport. Is there a way to do this?
I agree with Ischin's answer, but I will elaborate.
The Crosstab Report will allow you to have dynamic columns because it allows you to pivot your data. You can select one or more fields to group by to create the columns. The values of the groups become the labels for the columns and then you must use aggregate functions for the values in the report called Measures (e.g., sum or count). If you select more than one field, you will have multiple levels of columns. When you design the report, you pick the size of the columns--they must all have the same size.
JasperReports is a product designed for creating something that will print on a piece of paper consistently, like a PDF. iReport as of at least version 5.1.0, does not have any other way to truly dynamically create columns. You could write in logic to show or hide columns based on parameters, but this would be very tedious and does not fit in with what JasperReports is designed for. It would be very difficult, for example, to allow the user running the report to select parameters that allow the user to control which columns are in the report and the positions of the columns.