Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to claculate visits where exist at least one document

Good day!

I have two tables jrnVisits and docJournal.

I have count visits: select count(*) from jrnVisits.

Than i load theese tables and they has common key - idVisit.

select id as idVisit from jrnVisirs;

select idDoc, idVisit from docJounal;

My goal to calculate percent of succesfull visits.

Succesfull visits - visits that have documents.

By sql query i can do that:

All visits:

Now i Should count those visits where were made some documents at least >0 docs

I do it with sql query like:select count(*) from jrnVisits as jv

Succesfull visits:

select count(*) from jrnVisits as jv where exists (select * from docjournal where idVisit = jv. id)

when i load two theese tables to qlikview

it is very simple to coun all visits: Count(idVisits)

But how to count succesfull visits : something like(psuedocode): Count({where count(idDoc)>0}idVisit)

How to write this?





3 Replies
Not applicable
Author

Did you try:

Count({<idDoc-={''}>} idVisit)


That should count everything that doesn't have a blank idDoc. Sometimes QlikView works differently for blanks and nulls though. I tested with an Inline and blanks and it may work differently for nulls.

Not applicable
Author

Thank u very much, now it works))

Please can u say how did u know that, and where shoul i get info to build such expressions? )))

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

I'd recommend reading an article "Set Analysis" in the Help Section or in the Reference Guide.