Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
nevilledhamsiri
Specialist
Specialist

Need to included under major class its subs

Hi,

I have following sets of codes with their sub codes. If I am to bring these sub codes under their major codes what expression I need to make

MAJOR_CLASS          SUB_CLASS          VALUE

MC                                  1A                         50

MC                                   1B                         100

MC                                   1C                         75

PP                                     CH                         25

PP                                      SA                         10

After  I created a table it should look like below

MAJOR_CLASS          SUB_CLASS          VALUE

MC                                  MC                         50

MC                                  MC                         100

MC                                 MC                         75

PP                                   PP                         25

PP                                  PP                         10

Thanks

Neville

1 Solution

Accepted Solutions
balabhaskarqlik

May be this:

If(Match(Major_class,'CH','SA','PP'),'PP') as Major_class

View solution in original post

8 Replies
Lisa_P
Employee
Employee

What are you trying to achieve, I can't understand the logic as to why you would need this ?

nevilledhamsiri
Specialist
Specialist
Author

Dear Lisa,

Yes  assume I need to convert all sub classes in to the major class in such a scenario, how this could be achieved. Please design a set expression for this. Also I wish to know how this could be achieved in the script as well.

Thanks

balabhaskarqlik

ABC:

Load

Major_class,

Sub_Class,

Value from ABC.csv;

NoConcatenate

Temp:

Load

Major_class,

major_class as Sub_Class,

Value

Resident ABC;

Drop table ABC;

Add a Calculated Dimension in Chart object as

If(Major_class <> Sub_class, Sub_Class)

Label name: Sub_Class.

nevilledhamsiri
Specialist
Specialist
Author

Hi Bala,

This is fine, one more clarification that is to design an expression to be used in a case where PP is the major class & CH & SA if appearing under major class field with class PP, how I will rename both CH & SA as PP.If possible show me the way of doing it in script as well as in a chart

Thanks a lot

Lisa_P
Employee
Employee

If you are trying to replace the values in sub class:

ABC:

Load

Major_class,

Major_class as Sub_Class,

Value from ABC.csv;

But I still don't understand why as they will be associated anyway.

nevilledhamsiri
Specialist
Specialist
Author

Hi Lisa,

Please assume the fact that PP is one major product  & CH & SA too are appearing under Major class, If I am to rename both CH & SA as PP, how it could be done.

Thanks

Neville

balabhaskarqlik

May be this:

If(Match(Major_class,'CH','SA','PP'),'PP') as Major_class

nevilledhamsiri
Specialist
Specialist
Author

Thanks Bala,

This is what I all want!

Regards

Neville