Lynn Frieden Posted July 16, 2019 Share Posted July 16, 2019 Hello, I need to develop a calculated column that will determine the date of the First, Second, Third Monday, Tuesday, Wednesday, etc. of each Month. Is there a way to do that in Spotfire Link to comment Share on other sites More sharing options...
Shuting Fu Posted July 16, 2019 Share Posted July 16, 2019 The first step is to get the first day of the month [First day of the month]: Date(Year([MyDate]),Month([MyDate]),1)Based on this, the first Monday of the month can be calculated by: DateAdd("day",6 - DayOfWeek(DateAdd("day",5,[First day of the month])),[First day of the month])Similarly, the second Monday is: DateAdd("day",6 + 7 - DayOfWeek(DateAdd("day",5,[First day of the month])),[First day of the month])And the first Tuesday is: DateAdd("day",6 - DayOfWeek(DateAdd("day",4,[First day of the month])),[First day of the month]) Link to comment Share on other sites More sharing options...
Lynn Frieden Posted July 17, 2019 Author Share Posted July 17, 2019 I tested that as:Case when DateAdd("day",6 - DayOfWeek(DateAdd("day",5,[First day of the month])),[First day of the month]) then "First Monday" when DateAdd("day",6 + 7 - DayOfWeek(DateAdd("day",5,[First day of the month])),[First day of the month]) then "Second Monday" else "No" endI received an error "Invalid function call for 'If'" Am I missing something Link to comment Share on other sites More sharing options...
Shuting Fu Posted July 19, 2019 Share Posted July 19, 2019 This won't work because the the condition set for the "when" statement doesn't exist yet. You can try with document properties though. It depends on your data table structure to determine the custom expression syntax. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now