powerbi - Power BI Dax Group By Measure - 显示今天之前的日期
问题描述
我正在尝试创建一个度量,该度量将显示一段时间内的预订收入,按几个类别分组。当数据为 BLANK() 时,我还想在折线图中显示为 0,因此我将其放在 IF 语句中。一切都很好,除了出于某种原因我不能让它只显示今天之前的日期。
M_BookedRevenue =
VAR CurrentAccountingYear =
CALCULATE ( MIN ( 'Date'[AccountingYear] ), 'Date'[Date] = TODAY () )
VAR CurrentDate =
CALCULATE ( MIN ( 'Date'[SortDate] ), 'Date'[Date] = TODAY() )
RETURN
CALCULATE (
IF (
ISBLANK (
SUMX (
FILTER (
GROUPBY (
RevenueChannel,
RevenueChannel[ChannelBucket],
RevenueChannel[Channel],
'Date'[Date],
'Date'[SortDate],
'Date'[AccountingWeek],
'Date'[WeekNumber],
'Date'[AccountingMonthEnglishAbbrYear],
'Date'[AccountingMonth],
'Date'[AccountingYear],
"Revenue", SUMX ( CURRENTGROUP (), RevenueChannel[TransactionRevenue] )
),
'Date'[AccountingYear] >= CurrentAccountingYear
&& 'Date'[SortDate] < CurrentDate
),
[Revenue]
)
),
0,
SUMX (
FILTER (
GROUPBY (
RevenueChannel,
RevenueChannel[ChannelBucket],
RevenueChannel[Channel],
'Date'[Date],
'Date'[SortDate],
'Date'[AccountingWeek],
'Date'[WeekNumber],
'Date'[AccountingMonthEnglishAbbrYear],
'Date'[AccountingMonth],
'Date'[AccountingYear],
"Revenue", SUMX ( CURRENTGROUP (), RevenueChannel[TransactionRevenue] )
),
'Date'[AccountingYear] >= CurrentAccountingYear
&& 'Date'[SortDate] < CurrentDate
),
[Revenue]
)
)
)
解决方案
推荐阅读
- excel - 为什么我在 excel 中的 COUNTIF 函数不起作用?
- c++ - 如何在 cmake 中指定线程依赖项以跨平台方式分发仅标头库?
- postgresql - 来自 PowerShell 的 Postgres ODBC 连接字符串错误
- javascript - 如何防止用户在查看选项的源选项卡中查看网站和文件夹树的基本代码
- image - 有没有一种直接的方法可以在 Matlab 中为图像添加迷你图叠加层?
- javascript - 反应原生 - siganlR
- functional-programming - 如何在方案(N-queens)中从此函数中删除可变性
- python - 如何将用户的消息分配给 discord.py 中的变量?
- android - 有没有办法在兑换代码文本框android中以编程方式自动填充促销代码
- ruby-on-rails - 推送到 heroku 时出现“预编译资产失败”错误