Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
kolov007
Contributor III
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)
1 Solution

Accepted Solutions
sunny_talwar

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)

 

View solution in original post

2 Replies
StarinieriG
Partner - Specialist
Partner - Specialist

Hi,

this seems to work

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

sunny_talwar

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)