英文:
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:
答案1
得分: 0
使用一个像这样的计算列:
填充百分比 =
DIVIDE(
INT('表'[列1] <> "") + INT('表'[列2] <> ""),
2
)
请注意,在PowerBI中,一列只能有一个数据类型。
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论