Jump to content
We've recently updated our Privacy Statement, available here. ×

How to implement current month and previous months concept

Zakir Sharief

Recommended Posts


I have multiple data source, i would like to implement current month and previous months concept. In most of my data source i dont have a month option and every month the data keeps getting added.

Is there a way to differentiate between the previous month (all previous data put together) and current month (for the fresh data i have loaded). To be more specific assuming i have 1000 rows for year 2020 for all months till august (I want to call all this data as "previous month" or anything) and now in September i will refresh the current data assume 100 rows (I want to classify these rows are current month). So in my total 1100 rows (1000 rows would show prev month and 100 rows would show curr month).

I tried to use iron python script to update the value of the calculated column, as the below code is expression the same is updated in calculated column and hence when i refesh the value is getting updated for all the column.

from Spotfire.Dxp.Data import CalculatedColumn

Document.Data.Tables["dt"].Columns["Test"].As[CalculatedColumn]().Expression= "TRIM([column])"

Could some one help me in iron python script or if there is any other way to implement this instead of duplicating the tables since i many tables already in place.

Thank you.


Link to comment
Share on other sites

Assuming you have a [date] column, and that the current month is the actual current month (and not simply the latest month in your data) can you try to create a calculated column like this


when Month([date])=Month(DateTimeNow()) then "current"

else "previous" end

Also assuming you don't have previous years.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...