Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

huiyii_neo
New Contributor

Count with conditional expression?

Hi, Experts, I having a problem on counting dimension with some conditional expression.

In the red box (A) below.

I need to count the the number of enterprise which meet the condition expression.

when condition vYearlyKPI >= ContractedSLA then only take count the enterprise.


vYealyKPI =       (((1+(floor(date(ContractDuration_Date_Max)) - floor(date(ContractDuration_Date_Min))))*24*60)

        - (Sum( If(Outage_Month = Outage_Month and Outage_Year=year(Today()) and [Enterprise Name]=[Enterprise Name], [Negotiated Outage Duration (minute)]))))

        /((1+(floor(date(ContractDuration_Date_Max)) - floor(date(ContractDuration_Date_Min))))*24*60)

Can anyone help on this. Thanks!

Capture.PNG

1 Solution

Accepted Solutions
agigliotti
Honored Contributor II

Re: Count with conditional expression?

you should aggregate your variable "vYearlyKPI" maybe with a Sum( ... ) as well as Sum( [Contracted Availability (%)]/100 ).

4 Replies
agigliotti
Honored Contributor II

Re: Count with conditional expression?

maybe this:

Sum( Aggr( if( $(vYearlyKPI) > ContractedSLA, 1, 0 ), Enterprise ) )

huiyii_neo
New Contributor

Re: Count with conditional expression?

Hi, thanks, but this expression doesn't give the result I expect. The result should be "3" in this case.

Capture.PNG

agigliotti
Honored Contributor II

Re: Count with conditional expression?

you should aggregate your variable "vYearlyKPI" maybe with a Sum( ... ) as well as Sum( [Contracted Availability (%)]/100 ).

huiyii_neo
New Contributor

Re: Count with conditional expression?

Thanks I found the solution