3 Replies Latest reply: Jun 8, 2010 10:19 PM by Oleg Troyansky RSS

    How to claculate visits where exist at least one document

    EvgenyGin_J

      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?