Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
razvan_brais
Creator III
Creator III

Sort by field value

Hy guys , is there any way to sort one field by the value of other field?

I tried something like this , but it didn`t work:

if(LEVEL1='Clothes',match(LEVEL2,'Hat','T-shirt','Shirt'),

if(LEVEL1='Electronics',match(LEVEL2,'Laptop','Phone','SmartWatch')))

So the order should be

Clothes

  -hat

  -t-shirt

-shirt

Electronics

   -laptop

   -phone

   -smartwath

Thank you.

5 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

"It didn't work" does not describe the problem. So I am guessing here

if(LEVEL1='Clothes',match(LEVEL2,'Hat','T-shirt','Shirt'),

     if(LEVEL1='Electronics', match(LEVEL2,'Laptop','Phone','SmartWatch')+3))

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Anil_Babu_Samineni

Instead of that, You can try this too

If(Pick(LEVEL1='Clothes',match(LEVEL2,'Hat','T-shirt','Shirt')),

if(Pick(LEVEL1='Electronics',match(LEVEL2,'Laptop','Phone','SmartWatch'))))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
razvan_brais
Creator III
Creator III
Author

"It didn`t work" means that it doesn`t order after my expression. What I expect to see is the order from above ,

but what I see is this :

Clothes

  -t-shirt

-shirt

-hat

Electronics

-smartwath

-phone

  -laptop

Anil_Babu_Samineni

What expression you wrote?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
razvan_brais
Creator III
Creator III
Author

Both of them and still doesn`t work. When I`m writing your expression it gives me error in expression at the last ')'.