使用DAX函数在power BI中进行累计计算

Cumulative calculation in power BI using DAX funtion

我想从一个 table 比较另一个 table 的日期值来计算较低的日期值。 我的第一个 table 说 NewStateTable,

WorkItemId Title ChangedDate State StateChangeDate AreaPath
27997 logo in Code Provider Access 16-03-2021 19:25 New 12-03-2021 21:53 power
28339 Password policy needs to be updated 12-03-2021 21:54 New 12-03-2021 21:54 power
28464 Update Names of users names 12-03-2021 21:54 New 12-03-2021 21:54 power
29918 Add capturing capabilities on the Public Portal 24-03-2021 17:27 New 23-02-2021 21:53 power
29919 Refactor the code to make sure that the generated value done in a single location. 23-02-2021 21:55 New 23-02-2021 21:55 Empower
29943 Placeholder : "Provider Search Compare" needs to added on the Public Portal 11-03-2021 17:58 New 23-02-2021 22:26 power
29948 Add Document upload feature 23-02-2021 22:51 New 23-02-2021 22:51 power

我的另一个 table 说 AllIterationTable,

AreaPath IterationPath StartDate EndDate
power power - Sprint1 08-03-2021 00:00 13-03-2021 00:00
power power - Sprint 3 15-03-2021 00:00 20-03-2021 00:00
power power - Migration 22-03-2021 00:00 27-03-2021 00:00
power power - License 29-03-2021 00:00 03-04-2021 00:00

现在我想要 AllIterationTable 自定义列中所有 WorkItemId 的累计计数,其中 NewStateTable[ChangedDate] 小于 AllIterationTable[StartDate]

所以我应用了 Dax 函数,但它对我不起作用,

ChangedDateBeforeSprintStart = COUNTROWS(FILTER(ALL(NewStateTable),  NewStateTable[ChangedDate] <= AllIterationTable[StartDate]))

我的 DAX 函数应该是什么,它使用日期条件映射两个 table 并在 table 中创建自定义列。

试试这个:

= CALCULATE(COUNTROWS(NewStateTable), FILTER(NewStateTable, NewStateTable[ChangedDate] < (AllIterationTable[StartDate]) ))