I have a table (loaded from an CSV file) in Pentaho with many fields that I would like to transform into rows.
Imagine I have the following fields:
Name, City, Jan, Fev, Mar, Apr, ...., Dec, Total
10 records
Where the fields from Jan to Dec are numeric values. I need get each of the month fields and separate them into rows, in a new table like:
Name, City, Month, Value
10 * 12 records
I am currently using the "Select values" transformation to create 12 individual tables and then add their rows into a single table.
Isn't there any transformation that allows me to do this in an easier way?
There is a transform called "Row Normaliser" which does exactly this.
Add it to the graph and:
in the "Type field", you write "Month" (this will be a new field that will receive the values in the "type" column below)
in the "Fieldname" column, select all fields that are months in the original table
in the "type" column, write the name of the months as they should appear in the "Month" field of the result table
in the "new field" column, write the name of the field that will receive the values that are currently in the month columns. Example: "Monthly_Value".
Related
I have a table A which contains list of counties for a given year along with other records.
Columns are 'Year' and 'CountyName'.
For 2020, there are 6434 'Counties' listed and for 2019, 6433 'Counties' are listed (in the same table).
How do I find the CountyName that is missing in 2019?
I can ofcourse run a simple query to get these records individually and then find out the missing county but I am trying to check if it can be done at the query level.
Thank you.
You can easily achieve it with the usage of the not in function or the exist one.
Something like:
Select countryname from table where year =2019 and countryname not in (Select countryname from table where year =2020)
Date1 Date2 Line Item Total
May10,2009 May9,2009 10 40
May9,2009 May10,2009 20 10
May9,2009 May8,2009 20 30
May8,2009 May11,2009 30 0
This is my Table in Tableau. I want to create a calculated field for last column. If Date2 value has a match in Date1 Column, the new value is equal to the sum of all values corresponding to that that in Line Item column. Is this possible in tableau using calculation or in some way? example: 'May9,2009' in Date2 COLUMN has two occurrences in Date1 Column. hence the two values in Line Item column (20+20) is added and new calculated field shows 40.
Someone please help.
Maybe you can try doing a Join with the same table. Creating new rows matching Date2 with Date1 from a duplicated of the same table. Something like this (Hoja and Hoja12 are the duplicated sheets, my excel is in spanish):
And then calculate de SUM of each row aggregated by Date2. Then you can get a table like this one:
*For [Line Item] itself I had to use average because the data exists in multiple rows due to the join made, but in everyone is the same value. If you want a cleaner way of that maybe you can try using LODs.
Hope this helps.
(Perhaps another approach for the whole problem could be using the LODs, but that means a better comprehension of that kind of expressions and this method was the first one I thought about)
I'm trying to find a way to create a table like the one above, but instead of having columns of months I would like to have columns of MTD, QTD, YTD for all selected measure values. I created calculated fields on the [Date] field but when I try to use that it still splits the data in to separate columns of months and quarters... I'm using two data sources and they are linked on the [Date] field. If I try to put two of my calculated fields in the columns bar it just combines them like 'MTD/YTD'. How can I get them to display as separate columns?
I know this is strange because there will be overlapping data (everything in the MTD will also be in the QTD and the YTD).
I found a way to do this. I created a calculated field on the date field and assigned 'MTD' to all records from the last month. Then I assigned 'QTD' to all records from the start of the quarter to the day before the start date of the 'MTD' records. Then I assigned 'YTD' to all records from the start of the year to the day before the start of the 'QTD' records. (this way there are no overlapping records).
After that I just did a quick table calc to make each of them a 'running total' table (across).
I created parameters for the dates so the can easily be updated.
I'm new to Tableau and I'm trying to make measures from one data set dependent on a Dimension in another.
So I'm trying to link Expenditures of 2000,2012 and 2013 of one data source with year dimension which has only three values (2000,2012 and 2013) in another data source
Basically at the end I just need one Average Expenditure with its value for the corresponding years.
To link the two data sources by year, you will have to picot the table to bring it from a wide format (having each year in a separate column) to a long format (having each year in a separate row).
In Tableau go to the Data Source tab and select the three Expenditure columns, then right click on the header and choose "Pivot data".
That should bring your data in the correct format:
CountryA 2000 XXX
CountryA 2012 YYY
CountryA 2013 ZZZ
CountryB 2000 AAA
...
You might want to rename your columns to [Year] and [Expenditure] for example and you will have to create a calculated field with Right([Year], 4) to get only the year out of your former field name.
Now you can click on "Data" in the menu on the top and select "Edit Relationship", there you can choose the field with the year in one data source and the newly created calculated field in the other data source.
I need an expression to take an existing column and recreate this column over and over before another column/s where the column name contains either "Monday" or the date of the column falls on Monday.
The reason I need this expression is to repeat a header column in a pivoted report that is pivoting start/enddate parameter. So if a user selects to run the report for this month, they should get 31 columns (for each date/day) and header repeating before every Monday.
Make sure your dataset contains all the dates in your date range. If not create a date table and cross join to it. Don't pivot the results, let SSRS do that bit. Once your dataset has all the dates, you can use a matrix in your report and drop the date colum into the column group. This will give you one column for each date in your dataset. I'm not at my PC at the moment but if you need any more help, show an example of your dataset and I'll put together a quick sample report.