cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. ET on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
joann
Level IV

combine formula

Hi, could someone help me combine the 2 formulas below? The second one is simply minus the time of day part. Thank you.

 

----------------------------------------

 

New Column( "week start",
Numeric,
"Nominal",
Format( "m/d/y", 12 ),
Input Format( "m/d/y" ),
Formula(
If( Day Of Week( :WR_Date ) == 1,
(:WR_Date - In Days( Day Of Week( :WR_Date ) )) - In Days( 5 ),
(:WR_Date - In Days( Day Of Week( :WR_Date ) )) + In Days( 2 )
)
),
Set Selected
),
New Column( "Date[week start]",
Numeric,
"Nominal",
Format( "m/d/y", 12 ),
Input Format( "m/d/y" ),
Formula( :week start - Time Of Day( :week start ) ),
Set Selected
),

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: combine formula

I think you could also directly remove Time Of Day(:WR_Date) because the result of that if statement should have same hours, minutes and seconds as the :WR_Date column

 

Formula(
	If(Day Of Week(:WR_Date) == 1,
		(:WR_Date - In Days(Day Of Week(:WR_Date))) - In Days(5),
		(:WR_Date - In Days(Day Of Week(:WR_Date))) + In Days(2)
	) - Time Of Day(:WR_Date)
),
-Jarmo

View solution in original post

4 REPLIES 4

Re: combine formula

I'm doing this quickly, but I think this would work:

 

New Column( "Date[week start]",
Numeric,
"Nominal",
Format( "m/d/y", 12 ),
Input Format( "m/d/y" ),
Formula( ( If( Day Of Week( :WR_Date ) == 1,
(:WR_Date - In Days( Day Of Week( :WR_Date ) )) - In Days( 5 ),
(:WR_Date - In Days( Day Of Week( :WR_Date ) )) + In Days( 2 )
) )
 - 
Time Of Day( ( If( Day Of Week( :WR_Date ) == 1,
(:WR_Date - In Days( Day Of Week( :WR_Date ) )) - In Days( 5 ),
(:WR_Date - In Days( Day Of Week( :WR_Date ) )) + In Days( 2 )
) ) ) ) )

All I did is copied the first formula (for "week start") and replaced every reference to "week start" in the second formula with the copied information.

 

I added some extra spaces to (hopefully) see the formula  a little bit easier.

 

Also note that I did absolutely no testing to ensure this is correct.

Dan Obermiller
jthi
Super User

Re: combine formula

I think you could also directly remove Time Of Day(:WR_Date) because the result of that if statement should have same hours, minutes and seconds as the :WR_Date column

 

Formula(
	If(Day Of Week(:WR_Date) == 1,
		(:WR_Date - In Days(Day Of Week(:WR_Date))) - In Days(5),
		(:WR_Date - In Days(Day Of Week(:WR_Date))) + In Days(2)
	) - Time Of Day(:WR_Date)
),
-Jarmo
joann
Level IV

Re: combine formula

Thank you Jarmo! This works!
joann
Level IV

Re: combine formula

Thank you Dan! This works!

Recommended Articles