Data types in CSV
Using CSV data source you can indicate how data will be interpreted by Pivot table component. For this, you can use special prefixes for columns names. Pivot table has the following prefixes for CSV data:
+means that field is a dimension.
-field is a value.
m+this prefix will indicate that the field is a month.
w+to indicate that the field is a day of the week.
d+field is a date. Such field will be split into 3 different fields: Year, Month, Day. Date formats that are supported by Pivot table is described below.
D+field is a date. You will see such date as a hierarchy: Year > Month > Day.
D4+field is a date. You will see such date as a hierarchy: Year > Quarter > Month > Day.
ds+field is a date. Such field will be formatted using date pattern (default is
t+field is a time (measure). Such field will be formatted using
dt+field is a date (measure). Such field will be formatted using
id+field is an id of the fact.
Here is the minimal CSV data which will treat
Year as dimension, rather than numeric measure:
Country, +Year, Sales US, 2010, 200 UK, 2010, 100
Supported date formats
To make date column be interpreted as date, you should use prefixes
D4+ for CSV columns. Besides, data from these columns should have special date format to be understood properly.
The component supports ISO 8601 date (other formats may be used, but results can be unexpected). For example,
"2016-03-20" (just date) or
"2016-03-20T14:48:00" (date and time).
Here is an example of the CSV data with date columns –
Size, Discount, d+Date1, D+Date2 214 oz, 14, 2009-11-01, 2009-11-09 214 oz, 12, 2010-12-09, 2009-12-09 212 oz, 36, 2009-09-01, 2009-12-01 212 oz, 27, 2009-09-01, 2010-12-02 212 oz, 18, 2010-11-09, 2009-12-11 212 oz, 16, 2009-09-01, 2009-12-20
The pivot table based on this CSV will look as follows:
As you can see,
Date1 column with prefix
d+ is split into three separate fields —
Day. In Pivot component it will look as follows:
Date2 column with
D+ prefix is interpreted as a hierarchy that can be drilled down to months and days.