I have data like this in the postgres db column with two rows named Data_Column,
I would like to display the data like this,The colon left hand side is the column name and the colon right hand side is the column value.
I have tried crosstab function ,but it is not working for me.Can u help on this.
This can be achieved using substring() with a regular expression:
select substring(data_column from 'data_as_of_date:([0-9]+)') as data_as_of_date,
substring(data_column from 'unique_cc:([0-9]+)') as unique_cc
from the_table;
Related
I have a problem with Tableau.
I have a Dataset with some rows and some columns. I want to write a IFELSE structure where
The IF condition is that the Value of special field(fixed by a row and a column) is equal to the header of a column (it is every time equal to one name(header) of the different columns).
So to summarize: one value is every time equal to the name of a column and to find the column shall be the if-structure
Does someone know if there is a function to call the name (header) of a column? I didn't find it
Here is an small example, in which the Calculated_function choose the right price according to the Barcode. Everything in the first raw, is the header_name of the column below. enter image description here
Best regards
Jonas
You can work like this.
I created a sample dataset as given by you
Step-1: Connected With data in tableau. Clicked all columns having price (4 here), pivoted them so that they look like this..
Step_2: Create calculated_field like this
if [Barcode] = [Barcode_c]
then [Price] END
Step3: Filtered out null values from calculatedField and got a view like this which can be tweaked as per liking.
Hi I have data like this:
Sample Data
I want a chart like this:
Desired Output
Is it possible in Tableau or not? Please help.
First of all you have to pivot the dataset columns.
To do so, in the datasource section go select the 3 columns, right click and select pivot.
You'll get 2 new fields: Pivot Field Names and Pivot Field Values.
Drag the Pivot Field Values in the dimension panel.
From the analysis Menu uncheck Aggreate measures.
Finally you shold be able to get something like this:
I'm using Tableau. So, instead of giving the [Column_name], Is it possible to give [Column_number] in column shelf?
- Hariharasudhan. R.
No -- for good reason.
Think of the data source as a template for a potential SQL (or MDX or TQL) query; specifying tables, joins, unions and possibly some where/having clauses for data source filters.
The actual SQL generated for any particular view will be an (optimized) query that only selects columns that are actually needed for that particular view, adds where/having clauses based on the filters being used etc.
So a column doesn't have a fixed number. The same column may be the first field selected in one situation, the last field in another situation, and left off completely in another.
If you want to change the name of column shelf:
Create a duplicate of variable and change original with duplicates and assign name as your wish by right-click on Edit Aliases and change as per your requirement.
Go to Data Source
On the middle right corner check on Show aliases
Go to column and right click on it. Go to Rename
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'm designing a report on Ireport with a SQL query, and I'm working with filters, basically I want to be able to compare a input parameter "shift" with a field in my report, so I can show my report by shift.
This part of the report works fine, I just used a filtering expression $F{Shift}.equals( $P{shift} ), however this only works with one shift, but I want to also be able to see all shifts in the same report. Is there a way to do this?
As #Pu297 suggested, I could use an IN comparation in my SQL query, but setting it like this:
SELECT * FROM foo WHERE shift IN P!{shift}
Where my shift ireport parameter is a String and I type it in the way "1,2,3" to show the first 3 shifts
Your SQl Query
SELECT * FROM foo WHERE shift IN ($P!{shift})
And your input text should be
'1','2','3'