sumofscore = SUM(Sheet7[score])
占比 =
var thisscore=[sumofscore]
var cp= DIVIDE( CALCULATE([sumofscore],FILTER(ALL(Sheet7[name]),[sumofscore]>=thisscore)),[totalsum])
return cp
累计包含80%的分组求值=
var thisscore=[sumofscore]
var x1=SUMX(FILTER(ALL(Sheet7[name]),[sumofscore]>=thisscore&&[占比]>0.8),1)
var x2=IF(or(x1=1,ISBLANK(x1)),CALCULATE([sumofscore]),BLANK())
return x2
//[占比]度量先写好后被引用,而不能直接写进最后的公式
[占比]度量先写好后被引用,而不能直接写进最后的公式
2021-4-11
视图层写法
累计大于且包含80%的分组3 =
var t=ADDCOLUMNS(ALL('Fact'[name]),"sales",[sum of sales])
var t2=ADDCOLUMNS(t,"acc",SUMX(FILTER(t,[sales]>=EARLIER([sales])),[sales]))
var t3=ADDCOLUMNS(t2,"%",DIVIDE([acc],SUMX(t,[sales])))
var t4=MINX(FILTER(t3,[%]>=0.8),[%])
return
IF( MAXX(FILTER(t3,var n=SELECTEDVALUE('Fact'[name]) return [name]=n),[%])<=t4,"Y","N")













网友评论