在Power BI中,计算跨5列的填充单元格百分比的最佳方法是什么?

huangapple go评论87阅读模式
英文:

In Power BI, what is the best way to calculate the percentage of filled cells across 5 columns?

问题

=SUM(IF(ISTEXT(B2),20%,0),IF(ISTEXT(C2),20%,0),IF(ISTEXT(D2),20%,0),IF(ISTEXT(E2),20%,0),IF(ISTEXT(G2),20%,0))

在Power BI中,您可以使用以下公式来计算每行中5列数据中已填充列的百分比:

我知道这在Excel中可能也不是最佳方法。在Power BI中,最好的方法是什么?

我尝试了一些使用表格和列名称的度量,但我似乎做得不对。我觉得一定有一种更简单的方法我正在忽略。

因此,如果我有以下两行数据,最后一列将是我的百分比:

参见示例

英文:

I need to calculate the percentage of filled columns in each row across 5 columns of data. In Excel, I can use the following formula and format it as a %:

=SUM(IF(ISTEXT(B2),20%,0),IF(ISTEXT(C2),20%,0),IF(ISTEXT(D2),20%,0),IF(ISTEXT(E2),20%,0),IF(ISTEXT(G2),20%,0))

I know that this probably isn't the best way in Excel either. What is the best way to do this in Power BI?

I have tried a couple of measures using the table and column names, but I can't see to get it right. I feel like there has got to be a much easier way I am overlooking.

So if I had the following two rows, the last column here would be my percentage:

See example

答案1

得分: 0

使用一个像这样的计算列

填充百分比 = 
    DIVIDE( 
        INT('表'[列1] <> "") + INT('表'[列2] <> ""), 
        2
    )

请注意,在PowerBI中,一列只能有一个数据类型。

英文:

Use a calculated column like this one:

Pct Filled = 
    DIVIDE( 
        INT('Table'[Column1] <> "") + INT('Table'[Column2] <> ""), 
        2
    )

在Power BI中,计算跨5列的填充单元格百分比的最佳方法是什么?

Note that in PowerBI a column can have one data type only.

huangapple
  • 本文由 发表于 2023年3月7日 03:31:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/75655067.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定