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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

comparing two fields

Hi Guys!!!!!!!! hope all of u doing good..........

I have a column called state(i.e AP,TN,KL,KA...etc) and i have another field in the same table having multiple state values.Now i need to compare these two fields to derive another field.

For example :

                         State                Spec States    

                         AP                       TN,AP,KL        

                         KL                       GJ,DL,KA

                          DL                      DL,KA,KL

If Spec States contains State field value then result should be 1 otherwise 0.   

desired Output:

                         State                Spec States       Result

                         AP                       TN,AP,KL         1

                         KL                       GJ,DL,KA          0

                          DL                      DL,KA,KL          1

PFA and Kindly do needful help.

Reach me for more info if required.

1 Solution

Accepted Solutions
sunny_talwar

Couple of more options:

LOAD *,

  If(WildMatch([Specipic States], '*'&States&'*'), 1, 0) as NewResult,

If(Index([Specipic States], States), 1, 0) as NewResult2,

  If([Specipic States] LIKE '*'&States&'*', 1, 0) as NewResult3;

LOAD States,

    [Specipic States],

    Result

FROM

POC.xlsx

(ooxml, embedded labels, table is Sheet1);

View solution in original post

6 Replies
swuehl
MVP
MVP

Maybe like

LOAD *,

      If( WildMatch( [Specipic States], '*'&States&'*'),1,0) as NewResult;

LOAD States,

     [Specipic States],

     Result

FROM

[POC.xlsx]

(ooxml, embedded labels, table is Sheet1);

sunny_talwar

Couple of more options:

LOAD *,

  If(WildMatch([Specipic States], '*'&States&'*'), 1, 0) as NewResult,

If(Index([Specipic States], States), 1, 0) as NewResult2,

  If([Specipic States] LIKE '*'&States&'*', 1, 0) as NewResult3;

LOAD States,

    [Specipic States],

    Result

FROM

POC.xlsx

(ooxml, embedded labels, table is Sheet1);

vishsaggi
Champion III
Champion III

In the front end with expression in chart table as :

= IF(Match(MID(SpecStates, Index(SpecStates, State),2), State), 1,0)

Not applicable
Author

Thanks a lot buddy...!!!!!!!!!!!!!

Not applicable
Author

Great work. It's really helpful for me......

Not applicable
Author

Thanks Nagaraju.....