Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

get the text of a field in straight table

HI all.

I have a straight table like this:

In Expression column (in set analysis), I have to use the text of the corresponding country (on the same row). How could I do?

Thank a lot.

luca

1 Solution

Accepted Solutions
rubenmarin

The 'If' version can be:

Count(DISTINCT If(Country=ALT_COUNTRY, CITY))

View solution in original post

17 Replies
swuehl
MVP
MVP

Not sure what you are trying to achieve. The text of corresponding country is another field in the same table as Country, with a 1:1 relationship?

Then try

=Only( YourTextOfCorrespondingCountryField )

as expression.

Gysbert_Wassenaar

Try =Only([Country (Dim)])


talk is cheap, supply exceeds demand
Not applicable
Author

many thanks for reply.

I've tried, in set analysis

{<  FIELD = {'$(=Only(Country))'} >}

{<  FIELD = {"$(=Only(Country))"} >}

{<  FIELD = {$(=Only(Country))} >}

and don't work..

luca

Gysbert_Wassenaar

Why do you think you need to use a set analysis expression? Please explain what you're trying to achieve. What's the source data and what is the result table you want to see.


talk is cheap, supply exceeds demand
rubenmarin

You don't need to filter by Country, as the dimension does that for you, If you want to create some text using the Country value you can directly use the field:

='This country is ' & Country

Not applicable
Author

my expression is something like

= count ( distinct {< ALT_COUNTRY = {'$(=Only(Country))'} >} CITY )

where COUNTRY and ALT_COUNTRY are in separate tables with no link and have common value. I can't use ALT_COUNTRY as dimension.

Gysbert_Wassenaar

The set is calculated at the chart level, not the row level. That means you cannot use set analysis here. You have to use an if statement. But a better solution is to fix your data model.


talk is cheap, supply exceeds demand
jonathandienst
Partner - Champion III
Partner - Champion III

That should work, as long as there is only one possible value of Country (for example, a single selection), It will ignore the set expression if there is more than one possible country.To track multiple country selections:

= count ( distinct {< ALT_COUNTRY = P(Country)>} CITY )


Edit: I mean one global possible value, not just in a table row. As GW says, you can't do this on a row by row basis, but I am assuming that you are applying a single filter for all rows and Country is not associated with ALT_COUNTRY or CITY.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
jonathandienst
Partner - Champion III
Partner - Champion III

And QV field names are case sensitive COUNTRY <> Country

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