Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
BI & Data Trends 2021. Discover the top 10 trends emerging in today. Join us on Dec. 8th REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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
Highlighted
Partner
Partner

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

?

Highlighted

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)

Highlighted
Creator
Creator

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

Highlighted
Partner
Partner

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)

)