Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
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

Labels (1)
6 Replies
tresB
Champion III
Champion III

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 ?

tresB
Champion III
Champion III

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
Champion III
Champion III

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))