问题描述
在我的数据集中,每个 PolicyNumber
可以有多个 ClaimNumber
。因此,我要做的就是获取唯一的 PolicyNumber
并计算每个<$的索赔数量( ClaimNumber
) c $ c> PolicyNumber 。 (就像Excel中的数据透视表一样)
In my data set, each PolicyNumber
can have multiple ClaimNumber
. So all I want to do is to get Unique PolicyNumber
and Count the number of Claims (ClaimNumber
) for each PolicyNumber
. (Like a pivot table in Excel)
在Power BI中,我单击编辑查询
,单击分组依据
,指定要分组的列为 PolicyNumber
,为新列指定名称( CountOfClaims
),操作-计数行
...但是我无法选择列
的值。由于某种原因,它不起作用。如果我需要 Sum
,它可以工作,但是我只需要为每个 PolicyNumber计数
ClaimNumber
应该很简单。
我在这里想念什么?
In Power BI I click Edit Query
, click Group By
, specifying the column I want to group on which is PolicyNumber
, giving the name to new column (CountOfClaims
), Operation - Count Rows
...but I am unable to choose Column
value. For some reason its inactive. It works if I need to Sum
, but I simply need to count ClaimNumber
for each PolicyNumber
It should be so simple. What am I missing here?
这是我要实现的目标:
此外,当我在面板上选择分组依据时,该查询也会带有感叹号。我找不到它的意思。
Also when I am choosing Group By on a panel, then the query has Exclamation sign. I couldnt find a meaning of it.
推荐答案
在对行进行计数时,您要对哪一列计数都没有关系,这就是Power BI不会填充下拉列表的原因。
When counting rows it does not matter which column you count against, which is why Power BI doesn't populate the drop down.
分组依据对话框不支持不同的列数(截至2017年4月)。
The Group By dialog does not support distinct column counts (as for April 2017).
相反,可以使用将度量添加到数据模型。
Instead, you can add a measure to your data model, using DAX, that returns a distinct count.
=DISTINCTCOUNT([ClaimNumber])
或者,您可以创建第二个表,该表位于第一个表的顶部,其中仅包含 PolicyNumber
和 ClaimNumber
。然后,您可以按 PolicyNumber
分组并对行进行计数,这将返回不同的索偿计数。
Or you can create a 2nd table, that sits on top of the first, which contains only unique combinations of PolicyNumber
and ClaimNumber
. You could then group by PolicyNumber
and count the rows, which would return the distinct claim count.
这篇关于在PowerBI桌面中使用分组依据时,列值未激活的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!