给产品/运营的BI介绍和应用
目录
1、BI介绍
2、PowerBI
2.1 五步创建“商品销售排名”报表
2.2 可视化组件
3、MetaBase
3.1 10分钟创建 “站点库存查询” 报表
3.2 自定义查询
1、BI介绍
BI(BusinessIntelligence)即商务智能,它是一套完整的解决方案,用来将企业中现有的数据进行有效的整合,快速准确地提供报表并提出决策依据,帮助企业做出明智的业务经营决策。
BI的应用很多:

完整的BI(方案)应支持以下功能,一级为一级的基础:

目前市面上主流三大商业BI工具有:



市面上的BI工具:(不是方案)在整个BI解决方案中提供某些功能支持。
打着BI的旗号,实际却只是单纯数据工具的产品不少,
给人造成一种BI就是一种比EXCEL更现代一些的数据工具。
对比以下最出名的两个:


但是有个至关重要的条件:¥
如果用正版,Tableau可是太贵太贵,个人用户别想了,土豪除外;PowerBI,免费的哟——连Desktop都免费。
刚刚看的是商业BI,现在来看看开源BI工具的三剑客:Superset,Redash和Metabase

Superset最初是由Airbnb的数据团队开源的,目前已进入Apache Incubator,算是明星级的开源项目。

它的优缺点:
1 不能直接写SQL
通过选择指标(Metric), 分组条件(Group)和过滤条件(Filter)来画图表
2 不支持Join
如果一个图表里的数据要从多个数据表里取,那只能通过建视图来实现
3 支持文档一般
4 可以在多个时间维度上观察
从不同时间粒度去查看你关心的指标(小时/日/周/月/季度/年)
对时间序列做rolling average,比如看一个指标的7日平均线
可以对时间序列做偏移,再做对比,比如把本周的销售业绩
与上周同期放在一张图表中对比
不在图表上显示指标的绝对值,而是显示它随着时间变化的增长速度

Redash的口号是 “更纯粹地做好数据查询结果的可视化。”

它的特点:
1 支持多种数据源
SQL数据库,也支持MongoDB,Elasticsearch,Google Spreadsheet甚至是一个JSON文件
2 直接将SQL可视化
将SQL结果直接展示为图表
3 Query Snippet与Query Parameters
在Redash中我们可以将这些片段定义成Snippet复用 QueryParameters可以为查询添加可定制参数(生成下拉框来指定Where条件)
4 文档较完备清晰
5 可视化种类较Superset少

Metabase “更适合没有技术背景的人士的可视化工具。”

这个是我推荐的,它的特点了解一下:
1 界面清爽
简洁,好看
2 注重非技术人员的体验
方便运营,产品角色的使用,能自由探索数据,回答自己的问题
3 直接SQL可视化
SQL结果可定制视图显示
SQL参数组件化
查询结果可保存并分享(只读)
4 部署启动非常简便+强大
java -jar metabase.jar同时支持
•docker部署
•Amazon
AWSElastic Beanstalk
• Heroku
5 文档完备
2、PowerBI
1 五步创建“商品销售排名”报表
需求简述:可按:订单类型、订单终端下单时间、站点、品类各维度进行筛选得到
商品销售排序。
也就是下面的一个查询页面:

那我们的步骤应该是:

Step.1配置数据源


点“编辑”可对所选数据源(表)进行编辑查询(可选)
点“加载” 后可看到编辑页面出现对应数据源(表)
Step.2 编辑查询

编辑查询可对导入的表数据进行预处理,常见操作有:
1删除行/列
2替换空值
3拆分列(按分隔符)
4追加表(左连接)
5 也可使用高级编辑器(R语言)进行数据处理
a 加工处理后,点应用/关闭并应用保存加工步骤:

b 应用步骤视图
可编辑处理加工的步骤���

Step.3 指定实体关系
点关系按钮进入关系视图:

指定实体关系,是实现之后图表相关联动的基础。
在PowerBI刷新数据时,将根据关系验证数据的正确性,如出现问题(键重复等),
将会提示错误。
点击实体连线,编辑关系。记住勾选“使此关系可用”。

Step.4 设置数据可视化

简单来说3个操作:
a 选择可视化组件
b 拖入对应实体字段
c 设置可视化组件样式(可选)
界面真正“WYSIWYG”——所见即所得
下面看一个简单例子实现:按自提点查询订单量

报表窗格:所见即所得的报表主区域
字段窗格:从表中选取要展示/使用的字段
可视化窗格:选取可视化组件进行作为展示容器或筛选器。包含为字段、格式、分析三个配置项
建立快速度量值:总单数=COUNT('test订单列表'[订单编号])
度量值(Measure)非官方定义:可被DAX公式动态解析计算
并用于可视化组件展示的变量。
总单数= COUNT('test 订单列表'[订单编号])

总单数= COUNT('test 订单列表'[订单编号])
度量值类似SQL中的函数的结果的别名,上面的公司翻译成SQL会是:
SELECT
count(订单编号)
as 总单数 From test.订单列表
什么是DAX?Data Analysis Expressions (DAX)
它是用于创建度量值公式/表达式的一套函数和操作符 ,常见的函数有:
COUNT counts the number of cells in a column that
contain numbers.
COUNTA countsthe
number of cells in a column that are not empty.
DISTINCTCOUNT Countsthe
number of distinct values in a column.
AVERAGE Returns the average (arithmetic mean) of all the
numbers in a column.
….
Step.5 发布
将报表发布到powerbi网页版(微软服务器)
