Qlik Community

Ask a Question

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Talk to Experts Tuesday, January 26th at 10AM EST: Qlik Sense. REGISTER NOW
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
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

can you show me how please ?

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

can you show me how please ?

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.

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