# New to QlikView

Discussion board where members can get started with QlikView.

New Contributor III

## Count month with sales > 0

Hello.
Please tell me how to calculate the number of months for each product in which the sales amount should be more than 0.

For example, the product B in the filial A were sold for 4 months, but in the second month the amount of sales = -20 (we do not need to take this month)

Labels (2)

• ### Set Analisys

1 Solution

Accepted Solutions
MVP

## Re: Count month with sales > 0

Set analysis won't work here... try this

``Count(DISTINCT Aggr(If(Sum(Quantity) > 0, MonthNum), Filial, Product, MonthNum))``

or to make set analysis work, create a new field which combine Filial, Product, MonthNum into a single field... lets call it Key and then you can use this

``Count(DISTINCT {<Key = {"=Sum(Quantity) > 0"}>} MonthNum)``

2 Replies
Highlighted
Partner

## Re: Count month with sales > 0

Hi,

this seems to work

Count(distinct If(Aggr(Sum(Quantity),Filial, Product, MonthNum) >0, MonthNum))

MVP

## Re: Count month with sales > 0

Set analysis won't work here... try this

``Count(DISTINCT Aggr(If(Sum(Quantity) > 0, MonthNum), Filial, Product, MonthNum))``

or to make set analysis work, create a new field which combine Filial, Product, MonthNum into a single field... lets call it Key and then you can use this

``Count(DISTINCT {<Key = {"=Sum(Quantity) > 0"}>} MonthNum)``