本帖已被设为精华帖!
Table1 =
VAR tb1 =
CALCULATETABLE ( VALUES ( 'Table'[ID] ), 'Table'[People] > 100 )
VAR tb2 =
ALL ( 'Table'[ID] )
VAR tb3 =
UNION ( { 0 }, EXCEPT ( tb2, tb1 ), { 100000 } )
VAR tb4 =
SELECTCOLUMNS ( tb3, "value2", [Value] )
VAR gaptable =
ADDCOLUMNS (
GENERATE ( tb3, TOPN ( 1, FILTER ( tb4, [Value2] > [Value] ), [Value2], ASC ) ),
"gap", [value2] - [Value]
)
RETURN
ADDCOLUMNS (
'Table',
"gap", SUMX ( TOPN ( 1, FILTER ( gaptable, [Value] < [ID] ), [Value], DESC ), [gap] )
> 3
)
Table1 =
VAR tb1 =
CALCULATETABLE ( VALUES ( 'Table'[ID] ), 'Table'[People] > 100 )
VAR tb2 =
ALL ( 'Table'[ID] )
VAR tb3 =
UNION ( { 0 }, EXCEPT ( tb2, tb1 ), { 100000 } )
VAR tb4 =
SELECTCOLUMNS ( tb3, "value2", [Value] )
VAR gaptable =
ADDCOLUMNS (
GENERATE ( tb3, TOPN ( 1, FILTER ( tb4, [Value2] > [Value] ), [Value2], ASC ) ),
"gap", [value2] - [Value]
)
RETURN
ADDCOLUMNS (
'Table',
"gap", SUMX ( TOPN ( 1, FILTER ( gaptable, [Value] < [ID] ), [Value], DESC ), [gap] )
> 3
)
类似的思路,可以实现以下的效果
具体链接(这个写的有些复杂了,可以简化):
http://radacad.com/fun-with-dax-compressing-numeric-sequences-into-text
其他相关帖子,供参考
https://zhuanlan.zhihu.com/p/24568446?tdsourcetag=s_pcqq_aiomsg