Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
bhavvibudagam
Creator II
Creator II

Simple Sort expression correction needed

Hi Experts,

Can any one please help me on this.

I have a deals dimensions containing below records.

if condition.png

By if match condition I have  created 3 records by using the below expression.

=if(Match(Deals,'No. 1 Top Deal','No. 3 Top Deal'), 'No13Deals',

if(Match(Deals,'No. 5 Top Deal','No. 4 Top Deal'), 'No54Deals',

if(Match(Deals,'No. 2 Top Deal'), 'No2Deals')))

But getting sort order like

No13Deals,

No2Deals

No54Deals,

Expected Sort order:

No13Deals,

No54Deals,

No2Deals


I have tried the below sort expression but getting error in expression. Please correct the expression with this logic only.

=if((Match(Deals,'No. 1 Top Deal','No. 3 Top Deal'),'No13Deals'),1,

if((Match(Deals,'No. 5 Top Deal','No. 4 Top Deal'),'No54Deals'),2,

if((Match(Deals,'No. 2 Top Deal'),'No2Deals'),3)))

Thanks in advance.

Please find the attached app.

1 Solution

Accepted Solutions
Anil_Babu_Samineni

Try this?

=if(Match(Deals,'No. 1 Top Deal','No. 3 Top Deal'), Dual('No13Deals',1),

if(Match(Deals,'No. 5 Top Deal','No. 4 Top Deal'), Dual('No54Deals',2),

if(Match(Deals,'No. 2 Top Deal'), Dual('No2Deals',3))))

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

View solution in original post

4 Replies
Anil_Babu_Samineni

Try this?

=if(Match(Deals,'No. 1 Top Deal','No. 3 Top Deal'), Dual('No13Deals',1),

if(Match(Deals,'No. 5 Top Deal','No. 4 Top Deal'), Dual('No54Deals',2),

if(Match(Deals,'No. 2 Top Deal'), Dual('No2Deals',3))))

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
its_anandrjs
Champion III
Champion III

One of this also

=Only( {1} if((Match(Deals,'No. 1 Top Deal','No. 3 Top Deal'),'No13Deals'),1,

if((Match(Deals,'No. 5 Top Deal','No. 4 Top Deal'),'No54Deals'),2,

if((Match(Deals,'No. 2 Top Deal'),'No2Deals'),3))) )

its_anandrjs
Champion III
Champion III

Or may this

=Only( {1}  if(Match(Deals,'No. 1 Top Deal','No. 3 Top Deal'), Dual('No13Deals',1),

if(Match(Deals,'No. 5 Top Deal','No. 4 Top Deal'), Dual('No54Deals',2),

if(Match(Deals,'No. 2 Top Deal'), Dual('No2Deals',3)))) )

devarasu07
Master II
Master II

Hi,

best way just use the Dual function,

=if(Match(Deals,'No. 1 Top Deal','No. 3 Top Deal'), dual('No13Deals',1),

if(Match(Deals,'No. 5 Top Deal','No. 4 Top Deal'), dual('No54Deals',2),

if(Match(Deals,'No. 2 Top Deal'), dual('No2Deals',3))))

more about dual  check this article,

Dual & Exists – Useful Functions