Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

ziabobaz
Contributor II

Count Dimension only if Measure is positive

Trying to make simple calculation, tried both of below formulas, neither worked (still counts brands with Qty=0), please, help:


1. if(sum( [SalesQty]) > 0, count( distinct [Brand]),0)


2. count(

aggr(sum( {<SalesQty={">0"}>} Qty, Brand)

)


Tags (1)
1 Solution

Accepted Solutions
MVP
MVP

Re: Count Dimension only if Measure is positive

How about this

Count(DISTINCT {<Brand = {"=Sum([SalesQty]) > 0"}>} [Brand])

16 Replies
arulsettu
Honored Contributor III

Re: Count Dimension only if Measure is positive

may be like this

count(

aggr(sum( {<SalesQty={">0"}>} Qty), Brand)

)

agigliotti
Honored Contributor II

Re: Count Dimension only if Measure is positive

let's try this expression below:

count( {< Brand = {"=Sum(SalesQty)>0"} >} distinct Brand )


Hope it helps.

prat1507
Valued Contributor

Re: Count Dimension only if Measure is positive

Maybe this

Count(if(Aggr(sum( [SalesQty]),Brand)>0,Brand))

ogautier62
Valued Contributor II

Re: Count Dimension only if Measure is positive

Hi

or maybe this :

sum(if(aggr(sum(SalesQty),Brand) >0,1))

MVP
MVP

Re: Count Dimension only if Measure is positive

How about this

Count(DISTINCT {<Brand = {"=Sum([SalesQty]) > 0"}>} [Brand])

isingh30
Contributor III

Re: Count Dimension only if Measure is positive

May be this -


count(if(sum( [SalesQty]) > 0, distinct [Brand]))


ziabobaz
Contributor II

Re: Count Dimension only if Measure is positive

the result includes 0 values

ziabobaz
Contributor II

Re: Count Dimension only if Measure is positive

the result returns "-"

MVP
MVP

Re: Count Dimension only if Measure is positive

QlikView and Qlik Sense are case sensitive, have you checked if the field names are right?