Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
JVET
Contributor II
Contributor II

COUNT function: Error in set modifier

Hello.

I´m properly using this expresion on my app:

Aggr(sum(importe)-(15*max(clientes,mes_alta)),mes_alta)/sum(aggr(Max(clientes),mes_alta))

Now, I need counting how many of that values are less tan 0

I´ve tried this:

=count({<Aggr(sum(importe)-(15*max(clientes,mes_alta)),mes_alta)/sum(aggr(Max(clientes),mes_alta))={'<0'}>})

but returns  "error in set modifier".

Can help me?
Thanks.
Labels (1)
1 Solution

Accepted Solutions
MayilVahanan

Hi 

Try like below

Sum(Aggr(If(Aggr(sum(importe)-(15*max(clientes,mes_alta)),mes_alta)/sum(aggr(Max(clientes),mes_alta))< 0, 1), mes_alta))

 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

6 Replies
vinieme12
Champion III
Champion III

if(
Aggr(
(sum(importe)-(15*max(clientes)))
/
(Max(clientes))
,mes_alta) > 0
,
Aggr(
(sum(importe)-(15*max(clientes)))
/
(Max(clientes))
,mes_alta)
)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Andrea_Spinetti
Former Employee
Former Employee

Hey @JVET, I agree with @vinieme12's approach in this case as Set Analysis may not be the best option for this kind of calculation.

If the issue is solved please mark the answer with Accept as Solution.
JVET
Contributor II
Contributor II
Author

Hello @vinieme12 , thanks by your response. Your idea has not error, but doesn´t give me the result I need.  When I calculate  this:
Aggr(sum(importe)-(15*max(clientes,mes_alta)),mes_alta)/sum(aggr(Max(clientes),mes_alta))
I need to count in a different frame, how many of that values are negative.
Thanks.

MayilVahanan

Hi 

Try like below

Sum(Aggr(If(Aggr(sum(importe)-(15*max(clientes,mes_alta)),mes_alta)/sum(aggr(Max(clientes),mes_alta))< 0, 1), mes_alta))

 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
MayilVahanan

Can you please inform the reason for doing aggr() function in all places. 
importe, clientes, mes_alta are coming from same table? or different table?

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
JVET
Contributor II
Contributor II
Author

This works fine. Than you so much!!!