简体   繁体   English

Power Bi DAX:累积总和未显示正确数据

[英]Power Bi DAX: Cumulative Sum not Showing Correct Data

I am having trouble making a cumulative sum.我在计算累计金额时遇到问题。

It is showing data from the previous column instead of being a cumulative.它显示的是前一列的数据,而不是累积数据。

I have tested it out on a test file and it works fine but using the same format of the formula:我已经在测试文件上对其进行了测试,它工作正常,但使用了相同的公式格式:

QuoteValue running total in ClosedDate =在 ClosedDate 中的 QuoteValue 运行总计 =

Sales running total in Date = 
CALCULATE(
    SUM('Sheet1'[Sales]),
    FILTER(
        ALLSELECTED('Sheet1'[Date]),
        ISONORAFTER('Sheet1'[Date], MAX('Sheet1'[Date]), DESC)
    )
)

Im not sure what i am doing wrong, ive used ALLSELECTED, FILTER(ALL, ALL我不确定我做错了什么,我使用了ALLSELECTED, FILTER(ALL, ALL

The Quotevalue and Date are both in the same table and all other fields im using in the visual are all in the same table. Quotevalue 和 Date 都在同一个表中,我在视觉中使用的所有其他字段都在同一个表中。

Im stumped.我难住了。

Here is a dummy sheet i have put together.这是我放在一起的一张虚拟表。

Dummy Sheet虚拟表

Sales running total in Date = 
var person = 'Sheet1'[Person]
var toDate = 'Sheet1'[Date]
return CALCULATE(
    SUM('Sheet1'[Sales]),
        FILTER('Sheet1', 'Sheet1'[Person] = Person && 'Sheet1'[Date] <= toDate)
)

What we do here is that for each row, we get the other rows where persons are same and date is lower or equal.我们在这里所做的是,对于每一行,我们得到人员相同且日期小于或等于的其他行。 From this we calculate the sum.由此我们计算总和。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM