Power Bi Dax,仅在最后日期使用过滤器的总和列
我有一个'发票'
带有不同日期的金额,我想总结最大日期的金额。 例如,如果最大日期为25/03/2022,我将仅总结此日期的行。
last_month_amount = calculate(SUM(invoice[amount]),FILTER(invoice, invoice[date] = LASTDATE('invoice'[date])))
但是它可以计算所有金额,而无需任何过滤器。
在SQL中,我想要这个:
select sum(invoice.amount)
from invoice
where invoice.date = (select max(date) from invoice)
但是我明白了
select sum(invoice.amount)
from invoice
I've a table 'invoice'
of amount with different Dates, i want to sum the amount for the max date.
For example if the max date is 25/03/2022, i'll sum only the rows of this date.
last_month_amount = calculate(SUM(invoice[amount]),FILTER(invoice, invoice[date] = LASTDATE('invoice'[date])))
but it calculate all the amounts without any filter.
in sql i want this:
select sum(invoice.amount)
from invoice
where invoice.date = (select max(date) from invoice)
but i got this
select sum(invoice.amount)
from invoice
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
公式中有两个错误:
要解决问题,只需将最后一个日期存储在变量中:
There are two errors in your formula:
To solve the problem, simply store the last date in a variable: