Power BI中的汇总产品

时间:2019-01-16 09:17:03

标签: powerbi

我想使用Power BI从数据中计算每一行的历史信息。以下是我的示例数据:

       Column A   Column B        Column C        Column D
Row    Customer   Document Date   Clearing Date   Invoice_Amount
1       A          09/13/2016      11/04/2016      2,007,324
2       A          04/18/2016      07/11/2016      631,714
3       A          09/13/2016      09/16/2016      4,000,000
4       A          07/11/2017      09/23/2017      5,000,000
5       A          05/03/2016      06/17/2016      2,000,000
---     ---        ---             ---             ---
1158    H          04/21/2017      06/28/2017      3,000,000
1159    H          04/25/2017      05/19/2017      1,000,000
1160    H          11/03/2017      12/11/2017      4,500,000
1161    H          03/15/2018      05/27/2018      3,500,000
1162    H          02/21/2018      05/03/2018      1,500,000

我想创建一个新变量(添加新列)No_Paid,该变量计算“客户新发票的文档日期之前的已付款发票的总和。”

预期输出如下...

       Column A   Column B        Column C        Column D         Column E
Row    Customer   Document Date   Clearing Date   Invoice_Amount   No_Paid
1       A          09/13/2016      11/04/2016      2,007,324          8 
2       A          04/18/2016      07/11/2016      631,714            1
3       A          09/13/2016      09/16/2016      4,000,000          8
4       A          07/11/2017      09/23/2017      5,000,000          6
5       A          05/03/2016      06/17/2016      2,000,000          1
---     ---        ---             ---             ---              ---
1158    H          04/21/2017      06/28/2017      3,000,000          5 
1159    H          04/25/2017      05/19/2017      1,000,000          3
1160    H          11/03/2017      12/11/2017      4,500,000          7
1161    H          03/15/2018      05/27/2018      3,500,000         37
1162    H          02/21/2018      05/03/2018      1,500,000         37

在Excel中,我使用sumproduct函数获得以上输出

=SUMPRODUCT(($A$1:$A$1162 = $A1)*($C$1:$C$1162<$B1)*($B$1:$B$1162>DATE(YEAR($B1),MONTH($B1)-6,DAY($B1))))

Power BI可以执行此操作吗?谢谢

0 个答案:

没有答案