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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

expression error in SET Analysis with variable

Hi

I´m having a syntaxproblem with this Set Analysis

count({<AAR=vCurrentyear,Gruppe={'Tyveri fra borger'} >}JOURNALNR)

the problem lies at the comma after the vCurrentYear

I tried

count({<AAR={vCurrentyear},Gruppe={'Tyveri fra borger'} >}JOURNALNR)

but it doesnt work

1 Solution

Accepted Solutions
Colin-Albert
Partner - Champion
Partner - Champion

Hi Soren,

>>using yours gives me zeroes

Oops! I missed this reply earlier - the zero means that the set expression is correct, but there are no matching JOURNALNR values to count, hence the value is zero.

Do you get values returned for the expression  count({1 <AAR={'$(vCurrentyear)'}, Gruppe={'Tyveri fra borger'} >} JOURNALNR)

The 1 will cause the expression to ignore all other data selections. If you get data with this set, then view your current selections to identify what values are being filtered in your data.

If the 1 set expression above returns zero, then your data has no Journals for AAR=2014 and Gruppe = 'Tyveri fra borger'

View solution in original post

20 Replies
alexandros17
Partner - Champion III
Partner - Champion III

try this

count({<AAR={$(vCurrentyear)},Gruppe={'Tyveri fra borger'} >}JOURNALNR)


let me know

maleksafa
Specialist
Specialist

you need to add the $ sign before the variable in order to evaluate it, use $(vCurrentYear)

Colin-Albert
Partner - Champion
Partner - Champion

In set analysis expression modifiers, the field is always compared to a set of results, so the values after the = sign must be enclosed in parenthesis { }. Also variables should be enclosed in $() to ensure they are evaluated.

If vCurrentyear is text then the expression must be enclosed in quotes.

If vCurrentyear is numeric        use          count({<AAR={$(vCurrentyear)}, Gruppe={'Tyveri fra borger'} >} JOURNALNR)

If vCurrentyear is text     use       count({<AAR={'$(vCurrentyear)'}, Gruppe={'Tyveri fra borger'} >} JOURNALNR)

Not applicable
Author

Hi Alessandro

It doent work - it says expression ok, but I dont get a result only a -

Colin-Albert
Partner - Champion
Partner - Champion

Is vCurrentyear holding the data as text not numeric values?

Try adding quotes around the variable.

count({<AAR={'$(vCurrentyear)'}, Gruppe={'Tyveri fra borger'} >} JOURNALNR)

Not applicable
Author

Hi Colin

using yours gives me zeroes

Not applicable
Author

the variable vCurrentyear is made like this =year(today())

Colin-Albert
Partner - Champion
Partner - Champion

For the set expression to work, both the AAR data and vCurrentyear must hold the same values to match.

Can you post a screenshot of a listbox showing some AAR values.

Also the case of the Gruppe text must exactly match 'Tyveri fra borger'

Not applicable
Author

Hi Colin

Of course you are right

The AAR(means year in danish) is not made from a date, but is a text field.

If I use an expression like this

count(if(AAR=vCurrentYear,JOURNALNR))

it works fine