_add_months 配置之间

问题描述 投票:0回答:1

我有一份报告,其中我对车辆批发日期(日历度量)使用过滤器,试图引入前几个月的交易日期。

例如:今天是 8/10/23。我想查看上个月(7 月 1 日到 7 月 31 日)(每月第一天到最后一天)处理的所有数据点。

我使用了“(_add_days(_first_of_month(_add_months(current_date, -1))) and (_first_of_month(current_date)))”之间的变体和“_first_of_month (_add_months (current_date,-1) and _last_of_month (_add_months (current_date)”之间的变体)”。

当我使用“(_first_of_month(_add_months(current_date, -1)))”时,仅显示 7/1 的数据,而从 7/2 开始没有任何数据。我错过了什么?

date filter formula cognos days
1个回答
0
投票

我使用了“(_add_days(_first_of_month(_add_months(current_date, -1))) and (_first_of_month(current_date)))”之间的变体和“_first_of_month (_add_months (current_date,-1) and _last_of_month (_add_months (current_date)”之间的变体)”。

好的,你得到了什么结果?生成的 SQL 是什么样的?你的第二个例子应该有效,但我猜你实际上做了什么以及你说你做了什么。

当我使用“(_first_of_month(_add_months(current_date, -1)))”时,仅显示 7/1 的数据,而从 7/2 开始没有任何数据。我错过了什么?

你得到了什么结果? SQL 是什么样的?您使用的完整过滤器表达式是什么?就像您使用的其他两个示例一样,这只是片段。

我相信您想要过滤您的报告,以便只有上个月第一个月和上个月最后一个月之间某些活动的记录。这样的理解正确吗?

如果是这样,请创建一个与此类似的过滤器。

批发日期 _first_of_month ( _add_months ( current_date,-1) ) 和 _last_of_month ( _add_months ( current_date,-1) ) 之间

批发日期将是列的对象引用(如果您使用 FM 包,则带有方括号的内容(数据模块标识符使用查询主题(又名表).查询项(又名列)语法))。

您说您尝试过类似的方法但没有成功(尽管您没有说出发生了什么),这意味着您没有说明所有相关细节。

© www.soinside.com 2019 - 2024. All rights reserved.