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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
bbastro1106
Contributor III
Contributor III

COUNT with multiple conditions

 

Hi All,

 

I get stuck with below expression.

What i am trying to do is to perform a distinst count for style number, if

 Condition 1 : [Yearly_Erd In Dc Date] is = 2019 (AND)

Condition 2: [Quantity] is not equal to 0

Given the result will need to include the filter which user apply.

When i use the formula below, i am not able to get my result, it just give me "-" from the result.

=Count({$<[Yearly_Erd In Dc Date]={'$(=Year(Today()))'}>}, <Quantity = - {0}>} distinct [Style Number])

1 Solution

Accepted Solutions
Channa
Specialist III
Specialist III

=Count({$<[Yearly_Erd In Dc Date]={'$(=Year(Today()))'}>}, Quantity -=  {0}>} distinct [Style Number])

 

try

Channa

View solution in original post

6 Replies
Channa
Specialist III
Specialist III

=Count({$<[Yearly_Erd In Dc Date]={'$(=Year(Today()))'}>}, Quantity -=  {0}>} distinct [Style Number])

 

try

Channa
Shubham_Deshmukh
Specialist
Specialist

HI,

Try this : 
=Count(distinct{<[Yearly_Erd In Dc Date]={"=$(=year(today()))"},Quantity -={0}>}[Style Number])

Regards

uacg0009
Partner - Specialist
Partner - Specialist

Hi Bbastro,

There is a problem of your column [Yearly_Erd In Dc Date],

because you are using [Yearly_Erd In Dc Date] = 2019, so you need to make sure that the value of [Yearly_Erd In Dc Date] is not date type, it should be "year" type, like 2019, 2018, 2017....

And if it's not "year" type, you may try to use below expression:

=Count({<[Yearly_Erd In Dc Date] = {">=$(='2019-01-01')<=$(='2019-12-31')"},Quantity -= {"0"}>}distinct [Style Number])

Please try.

Aiolos Zhao

Channa
Specialist III
Specialist III

=Count(distinct{<year([Yearly_Erd In Dc Date])={"=$(=year(today()))"},Quantity -={0}>}[Style Number])

if this dosent work

 

create one new column in script

year([Yearly_Erd In Dc Date]) as Year

and use below

=Count(distinct{<year={"=$(=year(today()))"},Quantity -={0}>}[Style Number])

Channa
bbastro1106
Contributor III
Contributor III
Author

The value of [Yearly_Erd In Dc Date] is not a date type, it show like 2018, 2019...etc.

Channa
Specialist III
Specialist III

=Count(distinct{<[Yearly_Erd In Dc Date]={'$(=Max([Yearly_Erd In Dc Date]))'},Quantity -={0}>}[Style Number])

 

use this no need to use today()

Channa