Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
odassier
Creator II
Creator II

# of months with positive returns

Hello all,

I am trying to setup a KPI with the number of months in my history that had a positive result.

The total number of months in the data set was easy: Count([MonthStartDate.autoCalendar.YearMonth]) which returned the correct number (203).

Now I'd like to add two more KPIs.  One for the number of months with a positive return, one for the number of months with a negative return.

I tried: if(PA_Active>0,Count(PA_Active)) but that did not work.  it returns a "-"

Any ideas?

Thanks for the help.

Olivier

1 Solution

Accepted Solutions
odassier
Creator II
Creator II
Author

Hi Chanty,

This almost worked.  Fiddled with it a bit and found that it worked like this:

=count(if(PA_Active<0,PA_Active))

Thanks for the help

View solution in original post

7 Replies
Chanty4u
MVP
MVP

try this


=count(if(PA_Active>0,PA_Active),PA_Active)

agigliotti
Partner - Champion
Partner - Champion

maybe this:

Sum( Aggr( if( PA_Active>0, Count(PA_Active), 0 ), [MonthStartDate.autoCalendar.YearMonth] ) )

shraddha_g
Partner - Master III
Partner - Master III

TRy

Count( {<PA_Active {">0"}>}PA_Active) - - -  For Posititve

Count( {<PA_Active {"<0"}>}PA_Active) - - -  For Negative

odassier
Creator II
Creator II
Author

Hi Chanty,

This almost worked.  Fiddled with it a bit and found that it worked like this:

=count(if(PA_Active<0,PA_Active))

Thanks for the help

odassier
Creator II
Creator II
Author

Hi Shraddha,

thanks for this.  I tried it but it gave me an error message.  I'm going to use the simpler formula hinted at by Chanty above.

Cheers,

Olivier

shraddha_g
Partner - Master III
Partner - Master III

Yes I Missed '=' sign.

Count( {<PA_Active = {">0"}>}PA_Active) - - -  For Posititve

Count( {<PA_Active = {"<0"}>}PA_Active) - - -  For Negative

Chanty4u
MVP
MVP

good  it worked for you.