你见过这么坏的图表吗?阴影区是目标销售额的上下限,虚线是目标销售额,实线是实际销售额,开关标记的是相对于目标超出10%以下的销售额。
[En]
Have you ever seen such a broken chart? the shadow area is the upper and lower limit of the target sales, the dashed line is the target sales, the solid line is the actual sales, and the switch marks the sales below 10% excess relative to the target.
在以前要做这样的一份折线图,还是很麻烦,可是随着PowerBI的更新,原生图表也加入了越来越多的内容,今天就一起来体验下原生拆线图的进阶玩法。
; 简单拆线图
我们先来拖一个最简单的折线图,眼尖的可能已经看出来了,X轴并没有显示出所有的月份,而且X轴是从0开始的,幼儿园的小朋友都知道月份是从1开始的,PowerBI当然也知道,不过需要你来告诉它。
选择设置视觉对象格式—X轴,修改X轴的类型为类别,此时X轴已经包含了所有月份,但是顺序有点乱,从图形可以看出是按销售额降序排列的,所以我们还需要修改下排序方式。
点击折线图右上方的更多选项—排列轴,按月份升序排序
这样我们就得到一份相对规整的最简单的折线图了
进阶拆线图
上面的折线图无论是X轴还是Y轴都只有一个值,那如果X轴有多个值呢,比如年份和月份,这里直接使用了层次结构,层次结构的创建也很简单,这里就不再赘述。
这里折线图还有一个问题,就是X轴因为信息太多字体都倾斜,解决这个也很简单,关闭X轴的连接标签即可。
如果还想调整X轴的风格线,只需在网格线中调整
; 误差线
这个函数实际上是在3月份的更新中添加的,也就是文章开头看到的图片,使用了错误行。
[En]
This function was actually added in the March update, that is, the picture seen at the beginning of the article, using the error line.
为了动态控制,这里新建了一个参数,另外需要用到以下度量
Upper = [Plan] * [上下限 值]
Lower = [Plan] * -[上下限 值]
Label =
IF(
[Sales Amt] < [Plan] * 0.8 || [Sales Amt] > [Plan] * 1.1 ,
[Sales Amt]
)
选择最右边的格式选项,你会看到这里有很多功能,比如添加平均线、中值线等,这些功能以前已经提供过,设置起来也比较容易。我们找到错误行,将其应用于Sales,然后分别设置上限和下限。由于衡量标准的编写方式,应该相反地选择衡量标准和衡量标准之间的关系。效果如下
[En]
Select the format option on the far right, and you will see that there are many functions here, such as adding average lines, median lines, and so on, which have been available before and are relatively easy to set up. We find the error line, apply it to sales, and then place the upper and lower limits respectively. Because of the way the measure is written, the relationship between the measure and the measure should be chosen opposite. The effect is as follows
当然我们还可以选择显示为条形图,也可设置阴影区域的颜色。
接下来,就是添加目标销售额,并将其调整为虚线
接下来就是标签的显示了,这里需要再定义一个新的度量,当小于目标值的80%或者高于目标值的110%就显示标记,因为太高或太低在真实生产中可以算是异常值,需要找下原因的。
Label =
IF(
[Sales Amt] < [Plan] * 0.8 || [Sales Amt] > [Plan] * 1.1 ,
[Sales Amt]
)
这里要注意一定要将Label放到最上面,然后设置只有Label显示标记即可。
异常值
这个算是PowerBI AI功能中的一个,它会根据历史数据对未来数据有一个预测的上下限,然后超出上下限的会被标注为异常。但这里对放到X轴的数据有要求:
- 日期类型的值
- 日期层次结构的值(这个只有在打开自带的时间智能时才会有)
将X轴换成日期字段,就可以使用查找异常功能了,
但这里还有一个错误,那就是当点击离群值进行分析时,发布到云上仍然是一个错误,查找官方文档,并发现问题。
[En]
But here is another error, that is, when clicking on an outlier to analyze, publishing to the cloud is still an error, looking up official documents, and finding problems.
最后,实在是无奈之下打开了自动的时间智能
然后,重新拖放一张折线图,本地运行仍然出错。
发布到云端,再来看结果。只能说就很微软。
; 预测
预测和发现异常不能同时使用,你可以选择反向预测的长度,但我们不知道具体如何预测,老板很难回答这个问题。因此,使用历史同比的方法可能会更好、更容易理解常用的预测。
[En]
Forecasting and finding anomalies cannot be used at the same time, and you can choose the length of the backward prediction, but we do not know exactly how to predict it, and it is difficult for the boss to answer the question. therefore, the commonly used prediction may be better and easier to understand by using the historical year-on-year method.
总结
折线图作为PowerBI的的内置图表,应该是用的相对较多的图表之一了,微软已经赋予了它很多功能,虽然某些功能暂时体验下来效果并不是很好,但全靠同行衬托,目前没有能和PowerBI势均力敌的产品,希望国产BI软件可以早日出现在Gartner的魔力象限中,也希望微软在出新功能的同时,别忘了修补各种Bug。
另外,可通过阅读原文查看本文的示例文件。
参考
https://docs.microsoft.com/zh-cn/power-bi/visuals/power-bi-visualization-anomaly-detection
https://docs.microsoft.com/en-us/power-bi/create-reports/insights#considerations-and-limitations
Original: https://blog.csdn.net/bluefire5/article/details/124294527
Author: PowerBI木小桼
Title: PowerBI使用折线图分析异常数据

Opencv编译及调用GPU版本

PWA 学习笔记(五)

前向传播代码解析——你真的明白了吗?

无人驾驶综述:国外国内发展历程

探究torchAudio中wav2vec2的源码(二)——特征提取

win10安装cuda10.2+tensorflow-GPU 1.14.0

Anaconda+Tensorflow_Gpu+Spyder安装记录(2022年7月9日更新)

机器学习各种小问题

2021 年 10 大数据科学 Python 库

《kaldi语音识别实战》:带特征变换的三音素模型训练——train_lda_mllt.sh,train_sat.sh解析

利用opencv带你玩转人脸识别-中篇(人脸检测,检测多个,视频检测快速入门)

神经网络案例

NLP 实战(12): AI小组2022半年小结

聚类模型的简单介绍
