如何在Power Bi中分配轴的子类别 [英] how to distribute the subcategory of an axis in Power Bi

查看:214
本文介绍了如何在Power Bi中分配轴的子类别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一开始我有这张桌子

我想要的是将整个宇宙分为3个部分,所以我要做以下

what I want is to divide the universe into 3 sections, so I do the following

我相信列

UniqueRank = 
RANKX (
 inci;
  FORMAT (inci[nro_casos]; "0000" ) & inci[region] & inci[site]
)

然后我创建两个度量

 ranking_total = 
 RANKX (
   ALLSELECTED ( inci );
   inci[UniqueRank];
   MAX ( inci[UniqueRank] )
 )

 tirdh_case = IF(inci[ranking_total]<=COUNTROWS(ALLSELECTED(inci))*0.33;"3P";
 IF(inci[ranking_total]<=COUNTROWS(ALLSELECTED(inci))*0.66;"2P";"1P"))

然后,我会保留为如下。如您所见,可以应用星期和区域的过滤器,法线分为三个部分,但是我想在图形中显示它,并且希望将tirdh_case作为轴,为此,我创建了一个新表,称为'axis'

Then I would stay as follows. As you can see, filters of week and region can be applied and normal is divided into three parts, but I want to show it in a graph, and I want to put the tirdh_case as the axis, for this I create a new table called 'axis'

所以我创建了度量与这两个表相交的

so I create the measure that intersects these two tables

suma_inci = CALCULATE (
  SUM( inci[nro_casos] );
  FILTER ( inci; [tirdh_case] IN VALUES ('axis'[indice]) )
)

正如您在图像中看到的那样,该图形运行良好,但是我要插入站点列作为子类别,因此当我单击每个栏时,它会向我显示属于该栏的项目,但是发生的是所有站点都聚集在第一个栏中...您将如何链接这些站点并正确分类?

As you can see in the image, the graph works perfectly, but I am inserting the 'site' column as a subcategory, so that when I click on each bar it shows me the sites that belong to that bar, but what happens is that all the sites are accumulate in the first bar ... how would you link the sites and categorize correctly?

推荐答案

这是合乎逻辑的,因为度量是根据您的选择动态计算的。因此,当您使用 P1选择条形时,它需要重新计算拆分,因为这是您选择的结果。因此,如果您想更深入地了解这一水平,则需要将自己的度量设置为一列,以便对其进行静态划分。

This is logical because Measures are dynamically calculated based on your selection. So when you select your bar with the "P1", it needs to recalculate your splitting what is not possible because it is what you select. So if you want to go this level deeper, you need to make your measures a column so it is static divided.

您的列不像这样:

tirdh_case = 
var maxRank = MAX(inci[UniqueRank])
var splitNr = 3
var divider = maxRank/3
return CEILING((1 + maxRank - inci[UniqueRank])/divider;1) & "P"

您现在不需要额外的表,因为您可以将此列用作轴。我这样做的目的是,您可以根据自己的喜好更改splitNr。

You do not need an extra table now because you can use this column as your axis. I made it such that you can change the splitNr to your liking.

最终结果:

这篇关于如何在Power Bi中分配轴的子类别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆