Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
da_pagnott
Contributor III
Contributor III

Count if on chart

Hello guys,

I tried to search in the community but I couldn't find a similar question.

I'd like to add one more info to a Gauge chart with the result of last year (2017). I set the following expression but I get an error message and it doesn' work:

Count({<UserName={'NAME'},Year(DocDta)={'2017'} >} DocNum)

UserName it's an user associated to the transaction, DocDta it's a date value such as 11/12/2018 and DocNum it's an ID.

 

 

Thank you very much for your help!

 

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Create year field in the script and refer the same in set analysis like:

Year(DocDta) as DocYear

Count({<UserName={'NAME'},DocYear={'2017'} >} DocNum)

Else, use if statement like:

 

Count({<UserName={'NAME'}>} if(Year(DocDta)=2017, DocNum))

View solution in original post

3 Replies
tresesco
MVP
MVP

Create year field in the script and refer the same in set analysis like:

Year(DocDta) as DocYear

Count({<UserName={'NAME'},DocYear={'2017'} >} DocNum)

Else, use if statement like:

 

Count({<UserName={'NAME'}>} if(Year(DocDta)=2017, DocNum))
jonathandienst
Partner - Champion III
Partner - Champion III

The LHS of a set qualifier must be a field name. Expressions are not allowed. Follow Tresesco's advice about creating the field in the load script.

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

Year(DocDta)

try to put this as filter see wither you getting those expected years or not may it is to do with date format

 

your expression looking good 

Channa