cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Have your say in shaping JMP's future by participating in the new JMP Wish List Prioritization Survey
Choose Language Hide Translation Bar
paulp
Level III

Return earliest date only for TRUE values

 

Hello, I am creating a column formula that works half-right.  Using a formula as I don't know JSL.

For each Account grouping ==> return the earliest date for that Account

                                                   IF the Capture value ="TRUE".

                                                   ELSE leave a blank.

Some Accounts don't have any TRUE values and should return nothing but missing values.

paulp_0-1676499966563.png

JMP® Pro 17.0.0 (622753)

 

Suggestions?  thanks, Paul

2 ACCEPTED SOLUTIONS

Accepted Solutions
paulp
Level III

Re: Return earliest date only for TRUE values

Thierry, thank you for your reply.  I mis-specified my request, and your formula works for my misspecification. Below are screenshots of the logic I am looking for, and the associated small data set is attached.

 

Corrected request - 

1. Within an Account, find the Earliest Date that has Capture = TRUE.

==> maybe this Date is stored in a temporary variable?

2. Fill in this Earliest Date for every row of this Account.

3. If the Account never had a historical TRUE, leave every row blank.

==> signals that this Account never had any success.

 

Example of an Account that has Capture = TRUE in its history.

paulp_0-1676559787208.png

 

Example of an Account that never has Capture = TRUE in its history.

paulp_1-1676560639874.png

 

 

View solution in original post

txnelson
Super User

Re: Return earliest date only for TRUE values

Given your abbreviated sample table, here is the formula that should work

 

txnelson_0-1676563475335.png

Col Min( If( :Capture == "TRUE", :Date, . ), :Account )
Jim

View solution in original post

8 REPLIES 8
Thierry_S
Super User

Re: Return earliest date only for TRUE values

Hi,

You are mostly there. Try the following:

If (:Capture == "TRUE", Col Minimum (:Date, :Account, :Capture), .)

Best,

TS

Thierry R. Sornasse
paulp
Level III

Re: Return earliest date only for TRUE values

Thierry, thank you for your reply.  I mis-specified my request, and your formula works for my misspecification. Below are screenshots of the logic I am looking for, and the associated small data set is attached.

 

Corrected request - 

1. Within an Account, find the Earliest Date that has Capture = TRUE.

==> maybe this Date is stored in a temporary variable?

2. Fill in this Earliest Date for every row of this Account.

3. If the Account never had a historical TRUE, leave every row blank.

==> signals that this Account never had any success.

 

Example of an Account that has Capture = TRUE in its history.

paulp_0-1676559787208.png

 

Example of an Account that never has Capture = TRUE in its history.

paulp_1-1676560639874.png

 

 

txnelson
Super User

Re: Return earliest date only for TRUE values

Given your abbreviated sample table, here is the formula that should work

 

txnelson_0-1676563475335.png

Col Min( If( :Capture == "TRUE", :Date, . ), :Account )
Jim
paulp
Level III

Re: Return earliest date only for TRUE values

Thank you - I have tested your solution on a handful of accounts, and so far, it is working perfectly.  regards, Paul

Re: Return earliest date only for TRUE values

  xx

Re: Return earliest date only for TRUE values

I've deleted the reply (well, basically. I don't think you can delete but you can make the comment "xx") I originally made as Jim's is the way to go--

 

Cheers,

Brady

 

 

P_Bartell
Level VIII

Re: Return earliest date only for TRUE values

So I'm not the only one that has tried to delete a reply? Maybe a suggestion for the Community Discussion Forum web gurus? On more than one occasion for one reason or another I've wanted to delete a reply and couldn't figure out how to do it? But I like your 'xx' workaround. I'll remember this for future editorial work. Hope all is well.

paulp
Level III

Re: Return earliest date only for TRUE values

Brady, I appreciate your willingness to give it a try.  Your proposed logic was a novel approach, maybe it will spark something I can use in the future.  regards, Paul