Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

da_pagnott
New 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!

 

Tags (3)
1 Solution

Accepted Solutions
MVP
MVP

Re: Count if on chart

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
MVP
MVP

Re: Count if on chart

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

MVP
MVP

Re: Count if on chart

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
Valued Contributor III

Re: Count if on chart

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