cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

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

Need to populate no of unique entery

I need to populate no of unique entries in a new column if Flagged="Yes". When I use Col N Unique formula I get Different count if Flagged="No".

ConfidenceOwl94_0-1764787706153.png

 

8 REPLIES 8
jthi
Super User

Re: Need to populate no of unique entery

You are using Flagged == "Yes" as grouping "column" so it will calculate separate unique values for Yes and No. 

-Jarmo

Re: Need to populate no of unique entery

Any suggestion for how to populate Yes calculation in entire column?

Re: Need to populate no of unique entery

I don't have JMP 19, so no Col N Unique(), but I think this gets you what you want.  As Constant() makes the evaluation much faster.

 

As Constant( Length( Associative Array( :SN[Where( :Flagged == "Yes" )] ) << Get Keys ) )
jthi
Super User

Re: Need to populate no of unique entery

Current Data Table() << NEW COLUMN("A", Numeric, Formula(
	Col Sum(If(:Column 2 == "y" & Row() == Col Min(Row(), :Column 1), 1, 0))
));

I don't use JMP19 so I'm not that familiar with Col N Unique but maybe something like this

Current Data Table() << NEW COLUMN("A", Numeric, Formula(
	Col Max(If(:Column 2 == "y", Col N Unique(:Column 1, :Column 2), .))
));

Column 1 is SN and Column 2 is flagged

-Jarmo
hogi
Level XIII

Re: Need to populate no of unique entery

The Col N unique() function is so helpful!
It makes many analyses much easier.


I hope,

hogi_0-1764800147491.png

will work in JMP 19.x.



Looks straight forward- but at the moment this doesn't work
-  unfortunately, Col N Unique() behaved different to the other col ... aggregations:

hogi_1-1764800227423.png

[from  Tiny Traps in Jmp and JSL ].

hogi
Level XIII

Re: Need to populate no of unique entery

Other details you should be aware of:
Col score & Col N unique 

txnelson
Super User

Re: Need to populate no of unique entery

txnelson edit: This is not a solution.  See @hogi  answer below.

Here is how I would do it:

Current Data Table() << New Column( "A",
	Numeric,
	Formula(
		As Constant(
			theCount = N Rows(
				Current Data Table() <<
				get rows where( :column 2 == "y" )
			)
		);
		theCount;
	)
); 

 

Jim
hogi
Level XIII

Re: Need to populate no of unique entery

JMP 18:

New Column( "unique",
	Formula(
		As Constant(
			Length(
				Associative Array( :SN[Where( :Flagged == "Yes" )] ) << Get Keys
			)
		)
	)
)



JMP19:

dt << New Column( "unique",
	Formula(
		Col Max(
			If( :Column 2 == "y",
				Col N Unique( :Column 1, :Column 2 ),
				.
			)
		)
	)
);

 

JMP 19.x:

dt << new column("unique",
   Formula( Col N Unique(If(:Flagged == "y",:SN, .) )
));

 

JMP20?

dt << new column("unique",
Formula( Col N Unique(:SN, Where(:Flagged) )
));

The last one is my favorite - it will facilitate certain types of data analysis a lot!

please vote: Col Median (and others): add "Where" option 
otherwise we have to wait for v25 ...

Recommended Articles