简体   繁体   中英

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). I have a property control to input the number of months.

The easiest way to do this is with Month and Year . 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.

In other places, you can wrap this in an IF statement if you'd like. 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. 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()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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