Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
surendra_masupa
Contributor III
Contributor III

Set Analysis expression - issue with exclusion of concatenated string values

Hi All,

I'm struggling to write a set analysis expression to find the excluded value of strings.

To give the background, I've a list of people and cities where they operate. And I would write an expression where they won't operate.

I've written expression:

Concat( {$<AllCities-={$(=concat(DISTINCT chr(39)&OperatingCity&chr(39),','))}\>}DISTINCT AllCities,',') which works fine only when an agent is selected, else it returns null.

***Operating City = Combination of all the cities which I've cross joined to all the agents.

Pls help me regarding this.

Thank you!

1 Solution

Accepted Solutions
effinty2112
Master
Master

Hi Surendra,

          Try this:

Agent Operating CitiesConcat(Aggr(if(index(Concat(TOTAL <Agent> OperatingCity,'|'),AllCities) =0, AllCities), Agent, AllCities),', ')
KeirenKolkataBangalore, Chennai, Delhi, Mumbai
MartinChennai, DelhiBangalore, Kolkata, Mumbai
PeterBangalore, MumbaiChennai, Delhi, Kolkata
RyanMumbaiBangalore, Chennai, Delhi, Kolkata

View solution in original post

7 Replies
sunny_talwar

I believe set analysis is evaluated one per chart and that is why it isn't working, try this:

Concat(DISTINCT If(AllCities <> OperatingCity, AllCities),',')

My bad, this isn't completely working

surendra_masupa
Contributor III
Contributor III
Author

Hi Sunny,

This is not completely correct. When there are two or more operating cities for an agent, the result is incorrect.

Pls see the highlighted.

snip.JPG

effinty2112
Master
Master

Hi surendra,

How about :

=concat({$<AllCities -= {$(=Only(Aggr(concat(DISTINCT OperatingCity,', '), Agent)))}>}DISTINCT AllCities,', ')

This will work in a textbox when one agent is selected. It's more difficult to get an equivalent expression that would work in a straight table.

cheers

Andrew

surendra_masupa
Contributor III
Contributor III
Author

Nope, doesn't work.

The output is same as the one with my expression.

Anil_Babu_Samineni

Like this

Concat( {$<AllCities-={$(=concat(DISTINCT chr(39)&OperatingCity&chr(39),','))}\>}DISTINCT AllCities,',')

What is the use of Back slash there.

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
effinty2112
Master
Master

Hi Surendra,

          Try this:

Agent Operating CitiesConcat(Aggr(if(index(Concat(TOTAL <Agent> OperatingCity,'|'),AllCities) =0, AllCities), Agent, AllCities),', ')
KeirenKolkataBangalore, Chennai, Delhi, Mumbai
MartinChennai, DelhiBangalore, Kolkata, Mumbai
PeterBangalore, MumbaiChennai, Delhi, Kolkata
RyanMumbaiBangalore, Chennai, Delhi, Kolkata
surendra_masupa
Contributor III
Contributor III
Author

Thank you Andrew.