标签: excel pivot-table dax powerpivot
如何在数据透视表中具有多列的小计中找到百分比。
PercentYes := CALCULATE ( SUM ( MyTable[value] ), MyTable[answers] = "yes" ) / CALCULATE ( SUM ( MyTable[value] ), ALL ( MyTable[subcategory], MyTable[answers] ) )
答案 0 :(得分:1)
我创建了一个值样本
我首先创建一个总和度量:
Sum of Values:=SUM(MyTable[Value])
然后,我将创建百分比度量:
Percent of Values := DIVIDE ( [Sum of Values], CALCULATE ( [Sum of Values], ALL ( MyTable[Subcategory],MyTable[Answers] ) ) )
使用DIVIDE将有助于在分母中捕获零错误。结果看起来像这样: