Jump to content

Need to insert a calculated column with most common values in two columns


PR Bhat

Recommended Posts

I have three column in which different values are available. Need to insert a new column which gives the result of most common values in Col2,Col3,Col4 as Col5 will be new calculated collmn based on most common values of Col2,Col3,Col4. Is it possible to insert column without pivot or upivot in the same table.

 

 

 

 

Col1

Col2

Col3

Col4

Col5

 

 

A

NA

X

X

X

 

 

B

X

Y

X

X

 

 

C

Y

Z

Z

Z

Link to comment
Share on other sites

Gaia, I really like that approach. I couldn't think of a solution without writng my own data function. Or of course simply do an unpivot operation, calculated column, pivot operation.

 

So here your x = Concatenate([Col1],",",[Col2],",",[Col3],",",[Col4]). Right If you would work already with another calculated column that consists of Concatenate(...) then you probably could just use this column as your x. Sometimes I just prefer those extra steps as it makes everything more readable. But anyways... Great solution. I really need to work more with apply function.

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...