以下截图为加载数据的基本步骤:
关于加载数据中的一些注意事项:
组合图可以近似的看做条形图和折线图的组合。当需要展示同一个维度下两种不同种类的度量或者两种数据两级差别很大的度量时,组合图特别有用
垂直表是表格最基本的形式,当我们需要查阅明细数据的具体值的时候需要用到。表格同时显示多个字段,其中每行的内容在逻辑上相互关联。
透视表是将维度和度量显示表格中的行和列;在透视表中,可以同时通过多个度量并以多个维度进行分析数据,可以重新排列度量和维度以获取不同的数据视图,在行和列之间来回移动度量和维度的活动称为透视。
瀑布图适用于描述某一个度量数值的变化过程。瀑布图的最大一个特点是:前一个条形的重点一定是下一个条形的起点
分布图用于比较数值在数据组的范围和分布,数据绘制为沿着轴的值点可选择仅显示值点,以查看值的分布。选择边界框以查看值的范围
仪表盘是一种类似于KPI的可视化控控件,他们的区别在于仪表盘加入了一些额外的可视化效果辅助数据展示,使得数据的可读性更强
散点图可以帮助您找到两个值之间的潜在关系,并对组中的不规则性实现可视化。当想要显示每个实例都有两个指标,例如不同国家和地区的每个首府的平均寿命预期值和平均国内生产总值的数据时,散点图也很有用
故事的目的是收集对于整个分析的见解,并根据数据创建清晰的叙述。可以将故事展示位包含一张或者多张演示文稿的时间轴,并根据传统的数据叙述结构进行展示
故事都包含在应用程序中。要构建故事,可以使用数据可视化基于时间的快照和实时数据工作表,并将他们放置在故事的时间轴上,可以添加文本和造型,使用视觉效果突出某些见解的重点和运用各种风格等,使故事编的更加具有说服力更加精彩。
集合分析的本质是在某一个运算公式中通过修饰符插入限定条件,已达到限定聚合范围的效果。基本机构如下
Sum({<字段1={‘’},字段2={‘’},......>}度量字段)
其中字段X表示作为筛选条件的字段,度量字段表示求和之后的字段的名字
CrossTable (Month,Sales)
LOAD
Product,
"Jan 2014",
"Feb 2014",
"Mar 2014",
"Apr 2014",
"May 2014",
"Jun 2014"
FROM [lib://advanced_script/Product.xlsx]
(ooxml, embedded labels, table is Product);
drop table Name1[,Name2[,Name3,.....']]
drop field Name1[,Name2[,Name3,.....']]
load a,b,c from table1.csv;
join load a,d from table2.csv;
Transaction:
LOAD
"Transaction ID",
"Salesman ID",
Product,
"Serial No",
"ID Customer",
"List Price",
"Gross Margin"
FROM [lib://advanced_script/Transactions.csv]
(txt, codepage is 28591, embedded labels, delimiter is ',', msq);
join(Transaction)
LOAD
"Salesman ID",
Salesman,
"Distributor ID"
FROM [lib://advanced_script/Salesman.xlsx]
(ooxml, embedded labels, table is Salesman);
[Employees Init]:
LOAD
RowNo() as row,
Date(Date) as "Date",
Hired,
Terminated,
if (rowno()=1,Hired=Terminated,peek([Employee Count],-1)+(Hired-Terminated)) as [Employee Count]
FROM [lib://advanced_script/Employees.xlsx]
(ooxml, embedded labels, table is Sheet2);
//Add dummy people data
PeopleTemp:
LOAD * INLINE [
PersonID, Person
1, Jane
2, Joe
3, Shawn
4, Sue
5, Frank
6, Mike
7, Gloria
8, Mary
9, Steven,
10, Bill
];
//Add dummy age data
AgeTemp:
LOAD * INLINE [
PersonID, Age
1, 23
2, 45
3, 43
4, 30
5, 40
6, 32
7, 45
8, 54
9,
10, 61
11, 21
12, 39
];
//LOAD new table with people
People:
NoConcatenate LOAD
PersonID,
Person
Resident PeopleTemp;
Drop Table PeopleTemp;
//Add age and age bucket fields to the People table
Left Join (People)
LOAD
PersonID,
Age,
If(IsNull(Age) or Age='', Dual('No age', 5),
If(Age<25, Dual('Under 25', 1),
If(Age>=25 and Age <35, Dual('25-34', 2),
If(Age>=35 and Age<50, Dual('35-49' , 3),
If(Age>=50, Dual('50 or over', 4),
))))) as AgeBuck
Resident AgeTemp
Where Exists(PersonID);
DROP Table AgeTemp;
Events:
LOAD
EventID,
EventDate,
EventAttribute
FROM [lib://advanced_script/Events.txt]
(txt, utf8, embedded labels, delimiter is '\t', msq);
Intervals:
LOAD
IntervalID,
IntervalAttribute,
IntervalEnd,
IntervalBegin
FROM [lib://advanced_script/Intervals.txt]
(txt, utf8, embedded labels, delimiter is '\t', msq);
BridgeTable:
IntervalMatch (EventDate)
load Distinct IntervalBegin,IntervalEnd resident Intervals;
countryMap:
Mapping load * Inline[
Country,Newcountry
U.S.A,us
U.S.A.,us
U.S.,us
US,us
United States,us
United States of America,us
];
Data:
LOAD
ID,
Name,
ApplyMap('countryMap',Country,'us') as Country,
Code
FROM [lib://advanced_script/Data.xlsx]
(ooxml, embedded labels, table is Sheet1);
Data:
LOAD
ID,
Name,
ApplyMap('countryMap',Country) as Country,
Code
FROM [lib://advanced_script/Data.xlsx]
(ooxml, embedded labels, table is Sheet1);
Map Country using countryMap;
Data1:
LOAD
ID,
Name,
Country,
Code
FROM [lib://advanced_script/Data.xlsx]
(ooxml, embedded labels, table is Sheet1);
Data2:
LOAD
ID,
Name,
Country,
Code
FROM [lib://advanced_script/Data.xlsx]
(ooxml, embedded labels, table is Sheet1);
unmap; //此处指定之后的表不使用映射
Hierarchy (NodeID,ParentID,NodeName)
LOAD
NodeID,
ParentID,
NodeName
FROM [lib://advanced_script/Winedistricts.txt]
(txt, utf8, embedded labels, delimiter is '\t', msq);
store mytable into xyz.qvd (qvd);
store * from mytable into xyz.qvd