When using Group By in PowerBI desktop Column value is not active

烈酒焚心 提交于 2019-12-11 04:27:17

问题


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)

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?

This is what I am trying to achieve:

Also when I am choosing Group By on a panel, then the query has Exclamation sign. I couldnt find a meaning of it.


回答1:


When counting rows it does not matter which column you count against, which is why Power BI doesn't populate the drop down.

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])

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.



来源:https://stackoverflow.com/questions/43350523/when-using-group-by-in-powerbi-desktop-column-value-is-not-active

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!