Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
aniruddhyadutta
Creator
Creator

Coverting a condtion to set analysis

Can some help me convert this as set analysis:

I have some unique P_ids against which I am checking the below condition to  differntiate which are error and no error

=if ( not IsNull(C_ID) and not match(P_STATUS,'success') and  match(P_NAME,'SPL') and aggr(count(if (match(P_STATUS,'errors'),1)),C_ID)=1,'error','no_error')

I just want to get total number of 'error' or 'no_error'

so I am expecting some thing like

Count({$<condtion1,condition 2,condition 3>}  P_ids) -->total count for errors

similar one for no_error.

4 Replies
OmarBenSalem

what happens when you use your expression?

I mean the =if ( not IsNull(C_ID) and not match(P_STATUS,'success') and  match(P_NAME,'SPL') and aggr(count(if (match(P_STATUS,'errors'),1)),C_ID)=1,'error','no_error')

?

sunny_talwar

May be this

For count of errors:

=Sum(if( not IsNull(C_ID) and not match(P_STATUS,'success') and  match(P_NAME,'SPL') and aggr(count(if (match(P_STATUS,'errors'),1)), C_ID) = 1,1, 0)

For count of no errors:

=Sum(if( not IsNull(C_ID) and not match(P_STATUS,'success') and  match(P_NAME,'SPL') and aggr(count(if (match(P_STATUS,'errors'),1)), C_ID) = 1, 0, 1)

aniruddhyadutta
Creator
Creator
Author

As you see I have aggr function so I am not able to use in the back end to flag my data set rows.So I am left with the option of aggregating in the front end

OmarBenSalem

I meant that Qlik permits you to work with if conditions like you have been doing; if you expression works fine with if conditions, you can always use it without transforming it into a set analysis' shape; sthink like

sum(

if( not IsNull(C_ID) and not match(P_STATUS,'success') and  match(P_NAME,'SPL') and aggr(count(if (match(P_STATUS,'errors'),1)), C_ID) = 1,1, 0)

)