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

using only in if-condition

Hi qlikviewers,

Where is the error please ? i can't see it !!!!

=Count(DISTINCT if(Oppo_CreatedDate >= only(MonthStart(Date#(MoisAnnée,'MMM YYYY'))) // and Oppo_CreatedDate<= only(MonthEnd(Date#(MoisAnnée,'MMM YYYY'))) and IsNull(Oppo_Closed) , OpportunityCD))

Thanks a lot

6 Replies
tresesco
MVP
MVP

One issue:

You can't directly use one aggregation function (here only) within another (here count); you have to use it with AGGR.

Not applicable
Author

can you show me how please ?

sujeetsingh
Master III
Master III

Count(DISTINCT if(Oppo_CreatedDate >= only(MonthStart(Date#(MoisAnnée,'MMM YYYY'),1)) ))

-----In this you were missing brackets while closing and the value for if() statement

Not applicable
Author

can you show me how please ?

tresesco
MVP
MVP

I would give you a general example:

=concat(distinct IF(aggr(rank(sum(Sales)),Salesperson)<=3,Salesperson&CHR(13)))

Here, SUM has been used within another aggregation function CONCAT. And that has only been possible because of AGGR that defines the aggregation level (dimension).

I can't access app right now, otherwise would request you to share your sample app.

swuehl
MVP
MVP

If you don't want to use set analysis in your only() functions, I think you don't need only() here:

=Count(DISTINCT if(Oppo_CreatedDate >= MonthStart(Date#(MoisAnnée,'MMM YYYY'))

and Oppo_CreatedDate<= MonthEnd(Date#(MoisAnnée,'MMM YYYY')) and IsNull(Oppo_Closed)

, OpportunityCD))