简体   繁体   English

在Tibco spotfire中,从开始日期到系统日期每月限制数据

[英]Limiting data on monthly basis from start date to system date dynamically in Tibco spotfire

I've tried limiting data on monthly basis in spotfire and it's working fine. 我已经尝试在点火中每月限制数据并且它工作正常。

Now I'm trying to do like getting the records from the current date to month start date. 现在我想尝试从当前日期到月份开始日期获取记录。

For suppose if the current date is Sept 21, then i should get the records from Sept 21 to Sept-01(dynamically). 假设当前日期是9月21日,那么我应该从9月21日到9月1日(动态)获取记录。 I have a property control to input the number of months. 我有一个属性控件来输入月数。

The easiest way to do this is with Month and Year . 最简单的方法是使用MonthYear For example, in your visualization: 例如,在您的可视化中:

Right Click > Properties > Data > Limit Data Using Expressions (Edit) 右键单击>属性>数据>使用表达式限制数据(编辑)

Then, use this expression: 然后,使用以下表达式:

Month([TheDate]) = Month(DateTimeNow()) and Year([TheDate]) = Year(DateTimeNow())

This will limit the data to only those rows with the current Year/Month combination in your data column. 这会将数据限制为仅包含数据列中当前年/月组合的行。 Just replace [TheDate] with whatever your date column name is. 只需将[TheDate]替换为您的日期列名称即可。

In other places, you can wrap this in an IF statement if you'd like. 在其他地方,如果您愿意,可以将其包装在IF语句中。 It's redundant in this case, but sometimes helps with readability. 在这种情况下,它是多余的,但有时有助于提高可读性。

IF(Month([TheDate]) = Month(DateTimeNow()) and Year([TheDate]) = Year(DateTimeNow()),TRUE,FALSE)

@san - Adding to @scsimon answer. @san - 添加到@scsimon的答案。 If you would like to precisely limit values between 1st of the current month to current date, you could add the below expression to 'Limit data using expression' section. 如果要将当前月份的当前日期之间的值精确限制为当前日期,可以将以下表达式添加到“使用表达式限制数据”部分。

[Date]>=date(1&'-'&Month(DateTimeNow())&'-'&year(DateTimeNow())) and [Date]<=DateTimeNow()

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

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