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

查看:22
本文介绍了如何在 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 作为轴,为此我创建了一个名为的新表'轴'

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天全站免登陆