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: 
Compacte
Contributor
Contributor

How do I correctly add an AND operator to my expression?

My expression

Avg({$<GeoAreaName = P({<GeoAreaName = {'Belgium'}>})>}{$<SeriesCode = P({<SeriesCode = {'AG_LND_FRST'}>})>}Value)

Is only giving me the result of the second "filter" and I don't know how to add a AND operator to this.

Labels (1)
1 Solution

Accepted Solutions
mk1dangi21
Contributor II
Contributor II

you can try the following approach:

Avg({$<GeoAreaName = P({<GeoAreaName = {'Belgium'}>}), SeriesCode = P({<SeriesCode = {'AG_LND_FRST'}>})>}Value)

This expression combines both conditions inside a single set analysis expression. The expression calculates the average 'Value' when both 'GeoAreaName' is 'Belgium' and 'SeriesCode' is 'AG_LND_FRST'. By placing both conditions within the same set analysis, the AND operator is implicitly applied.

 
 

View solution in original post

6 Replies
BrunPierre
Partner - Master
Partner - Master

Avg({$<GeoAreaName = {'Belgium'}, SeriesCode = {'AG_LND_FRST'} >} Value)

Compacte
Contributor
Contributor
Author

Thanks for the reply, unfortunately it still only gives the result of the first half.

mk1dangi21
Contributor II
Contributor II

you can try the following approach:

Avg({$<GeoAreaName = P({<GeoAreaName = {'Belgium'}>}), SeriesCode = P({<SeriesCode = {'AG_LND_FRST'}>})>}Value)

This expression combines both conditions inside a single set analysis expression. The expression calculates the average 'Value' when both 'GeoAreaName' is 'Belgium' and 'SeriesCode' is 'AG_LND_FRST'. By placing both conditions within the same set analysis, the AND operator is implicitly applied.

 
 
BrunPierre
Partner - Master
Partner - Master

How about just like this.


Avg({$<GeoAreaName = {'Belgium'}, SeriesCode = {'AG_LND_FRST'} >} Value)
Kushal_Chawda

@Compacte  can you share sample with expected output?

Compacte
Contributor
Contributor
Author

This worked indeed. I'm guessing it was the single set analysis which was needed. Thank you!