Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
patriciousa
Creator II
Creator II

Insert Field when equal to other column multiple values

Hi Qlik Community.

I'm here today with what must be a really easy task.

I need to insert a Field but only when is equal to other column values.

Here is my table:

   

NombreCategoría
Manuel AndresJPE
María del MarJPE
Gabriela SusanaSupervisor
GustavoDirector
ChristianSenior
Damian UrielJP
RamonGerente
HernanGerente
Leandro MartinSenior
Carlos MatiasSenior

I want to insert in my table in Qlik Sense the Column "Nombre" when "Categoría" is equal to JP, JPE and Senior.

I bet this has to be like the easiest thing in Qlik but I can't figure out how to do it.

Thank you in advance.

Regards.

1 Solution

Accepted Solutions
sunny_talwar

When using it as a dimension you need an Aggr function, try this:

=Aggr(Only({<Categoria = {'JPE', 'JP', 'Senior}>} Nombre), Nombre)

Alternatively this should also work:

=If(Match(Categoria, 'JPE', 'JP', 'Senior), Nombre)

But my suggestion is that you can get the same result by using set analysis in all your expressions. You just need to use Nombre as dimension and then within the expression use {<Categoria = {'JPE', 'JP', 'Senior}>}

For example if your current expression is -> Sum(Sales), change it to Sum({<Categoria = {'JPE', 'JP', 'Senior}>}Sales) Your Nombre will only show those names which are from one of the three Categoria listed in the set analysis. This is more efficient then using calculated dimension.

View solution in original post

12 Replies
sunny_talwar

May be this:

LOAD Nombre,

          Categoria

FROM Source

Where Match(Categoria, 'JPE', 'JP', 'Senior');

patriciousa
Creator II
Creator II
Author

To clarify, I need to Load all the categories, however, in the table view I'm making in Qlik Sense, I only have to show JP, JPE, Senior.

Thank you for your reply.

sunny_talwar

Oh okay, may be this in that case:

{<Categoria = {'JPE', 'JP', 'Senior}>}

This will go within all your expressions.

patriciousa
Creator II
Creator II
Author

Thank you for quick reply Sunny-T but still need help.

The expression you gave is looking good but I need to insert the "Nombre" Column when {<Categoria = {'JPE', 'JP', 'Senior}>}

How do I do it?

Thank you again!

sunny_talwar

Not entirely sure how and where you are using this, but may be this:

Only({<Categoria = {'JPE', 'JP', 'Senior}>} Nombre)

patriciousa
Creator II
Creator II
Author

Qlik Sense, as Dimension, in a Table.

There, where it says Colaborador JP-Seniors. I need to insert only the "nombre" when is equal to those categories.

If I paste what you gave me Only({<Categoria = {'JPE', 'JP', 'Senior}>} Nombre) it says Error in Expression.

Try adding a , before Nombre, didn't work.

The Field "Nombre" is not being recognized as a Field.

Thank you.

Regards.

sunny_talwar

When using it as a dimension you need an Aggr function, try this:

=Aggr(Only({<Categoria = {'JPE', 'JP', 'Senior}>} Nombre), Nombre)

Alternatively this should also work:

=If(Match(Categoria, 'JPE', 'JP', 'Senior), Nombre)

But my suggestion is that you can get the same result by using set analysis in all your expressions. You just need to use Nombre as dimension and then within the expression use {<Categoria = {'JPE', 'JP', 'Senior}>}

For example if your current expression is -> Sum(Sales), change it to Sum({<Categoria = {'JPE', 'JP', 'Senior}>}Sales) Your Nombre will only show those names which are from one of the three Categoria listed in the set analysis. This is more efficient then using calculated dimension.

patriciousa
Creator II
Creator II
Author

You got it! It worked!

Thank you a lot, again!

Regards!

sunny_talwar

Hahahaha, More like 'We got it'