答案 0 :(得分:1)
在计算列中:
NumberOfEventsInQueue =
IF (
ISBLANK ( Table1[NoOfEventsAtATime] ),
BLANK(),
CALCULATE (
SUM ( Table1[NoOfEventsAtATime] ),
FILTER (
ALL ( Table1 ),
Table1[Ref_Time] >= EARLIER ( Table1[Ref_Time] )
)
)
)
如果您的NoOfEventsAtATime
列中间有空白行,并且仍然希望在计算所得的列中返回一个值,则可以使用以下方式:
NumberOfEventsInQueue =
VAR TimeMin =
CALCULATE (
MIN ( Table1[Ref_Time] ),
FILTER (
ALL ( Table1 ),
NOT ISBLANK ( Table1[NoOfEventsAtATime] )
)
)
VAR TimeMax =
CALCULATE (
MAX ( Table1[Ref_Time] ),
FILTER (
ALL ( Table1 ),
NOT ISBLANK ( Table1[NoOfEventsAtATime] )
)
)
VAR Output =
IF (
Table1[Ref_Time] >= TimeMin && Table1[Ref_Time] <= TimeMax,
CALCULATE (
SUM ( Table1[NoOfEventsAtATime] ),
FILTER (
ALL ( Table1 ),
Table1[Ref_Time] >= EARLIER ( Table1[Ref_Time] )
)
),
BLANK()
)
RETURN Output