Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Count distinct on a if-variable condition

Hi,

I need some help to set a formula.

I have a variable, vStock, that calculate the items stock at a given date:

SUM({$<StockDate={">=$(=MIN(DateInit))"}>*$<StockDate={"<=$(=MIN(DateEnd))"}>} Quantity )

I'm trying to count the distinct items where stock is greather than zero, for example:

COUNT DINTINCT [Item] WHERE [vStock]>0

After some research I find out this formula, but is very slow (and I don't know if it is correct):

COUNT(DISTINCT AGGR(if($(vStock)>0, Item), Item))


There is another, simple way to calculate this without Aggr and/or If statement?

Labels (1)
1 Reply
Thiago_Justen_

Gabriele,

What about this:

Count({<ITEM={"=$(vStock)>0"}>} Distinct ITEM)


Cheers

Thiago Justen Teixeira Gonçalves
Farol BI
WhatsApp: 24 98152-1675
Skype: justen.thiago