Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to count with two conditions.

Dear all.

I have a database with three columns, the first is call "ID", the second one is call "ID del Incidente Padre" and the third one is call "Area/Subcategoria", i need to obtain the count using the three fields, for example, count the "ID" column if the column "ID del Incidente Padre" is empty, and the column "Area/Subcategoria" contain the word Evento.

How can i do this?

Sorry me english.

Best regards.

Labels (1)
9 Replies
MayilVahanan

Hi

If(ID = '', if("ID Del Incidente Padre" = '', Count(Area/SubCategoria),Count([ID Del Incidente])),Count(ID))

or

If(Count(ID) = 0, if(Count([ID Del Incidente Padre]) = 0, Count(Area/SubCategoria),Count([ID Del Incidente])),Count(ID))

If you want distinct count, please add the distinct in your expression

Hope it helps

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

Hi.

Sorry but it doesn't work, i tried with something like that.

if((Area/SubCategoria) = 'Evento', count (if(len([ID Del Incidente Padre])=0, ID))

But it doesn't work too.

Somebody can help me??

MayilVahanan

Hi

can you provide a sample file?

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

IDID del Incidente PadreArea/Subcategoria
IM345652Incidente
IM456768IM23456Evento
IM453636Evento
IM83738IM56434Incidente
IM63536Evento

In the table you can see an example, we have the three columns as i explained, in this case i need to count the elements in 'ID' column, when the column 'ID del Incidente Padre' is empty and the column 'Area/Subcategoria' contain the word 'Evento', as you can see on the example the result must be 2, that correspond to the ID IM453636 and IM63526.

Best Regards

v_iyyappan
Specialist
Specialist

Hi,

Can you provide me detailed information about the links between the fields "ID Del Incidente Padre",Area/SubCategoria, ID.

and what type of object you are using? and also about dimensions?which is easy to help you out.

Iyyappan

v_iyyappan
Specialist
Specialist

Try something like this

Sum(Aggr(if(len(trim([ID Del Incidente Padre]))=0 and [Area/SubCategoria]='Evento',1),[ID Del Incidente Padre],Area/SubCategoria))

Iyyappan

MayilVahanan

HI

Try something like this,

     =Count({<[Area/Subcategoria] = {'Evento'},[ID del Incidente Padre]={''}>}Distinct ID)

or

If(Len([ID del Incidente Padre]) = 0, Count({<[Area/Subcategoria] = {'Evento'}>}Distinct ID))

Can you provide the detail as iyyappan asked?

Hope that helps..

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

Hi.

Attach you can find the example in order that you see the things that i want to obtain.

Best Regards.

Not applicable
Author

See attached.