Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
Highlighted
Not applicable

¿How to cout and IF?

Hi there,

I have a big problem count with if.

I have 3 fields (in Excel file) ID, DATE1 and DATE2 something like that:

   

IDDATE 1DATE 2
120/04/201620/04/2016 10:11
220/04/201620/04/2016 10:03
320/04/201620/04/2016 09:26
420/04/201620/04/2016 08:22
520/04/201620/04/2016 08:21
620/04/201620/04/2016 07:43
720/04/201620/04/2016 09:26

I make a IF combination that depends of some values.

I make a Table in qlik and add as Dimension ID, DATE 1 and DATE 2 and as measure "IF combination"

The table in qlik shows like that:

    

IDDATE 1DATE 2if((interval(AVG({$<
120/04/201620/04/2016 10:11YES
220/04/201620/04/2016 10:03YES
320/04/201620/04/2016 09:26YES
420/04/201620/04/2016 08:22YES
520/04/201620/04/2016 08:21NO
620/04/201620/04/2016 07:43NO
720/04/201620/04/2016 09:26YES

Previous table works! but i need count YES of this measure and divide by the total ID!

I tried create like a variable (dont works)

I tried make a count(statement) (dont works).

I dont know what to do! 

Thanks for all.

4 Replies
Highlighted
MVP
MVP

Re: ¿How to cout and IF?

Script is

LOAD ID,

    [DATE 1],

    [DATE 2],

    [if((interval(AVG({$<] as Field

FROM

[https://community.qlik.com/thread/214302]

(html, codepage is 1252, embedded labels, table is @2);



expression in textbox

=num(count({$ <Field={'YES'}>} Field) / Count(ID), '#,##0.00%')

1.png

Highlighted
Not applicable

Re: ¿How to cout and IF?

I have some errors.

Can you send me the .qvf?

Thanks!

Highlighted
MVP
MVP

Re: ¿How to cout and IF?

What is the expression which gives you YES and NO?

Not applicable

Re: ¿How to cout and IF?

(if((interval(AVG({$<[Categoria del sitio]={'C1'},[Status]={'Closed'},[Tracker]={'CM'}>}[Displacement time]), 'hh:mm:ss'))<='1','YES',

  if((interval(AVG({$<[Categoria del sitio]={'C2'},[Status]={'Closed'},[Tracker]={'CM'}>}[Displacement time]), 'hh:mm:ss'))<='3','YES',

    if((interval(AVG({$<[Categoria del sitio]={'C3'},[Status]={'Closed'},[Tracker]={'CM'}>}[Displacement time]), 'hh:mm:ss'))<='3','YES',

        if((interval(AVG({$<[Categoria del sitio]={'C4'},[Status]={'Closed'},[Tracker]={'CM'}>}[Displacement time]), 'hh:mm:ss'))<='8','YES',

            if((interval(AVG({$<[Categoria del sitio]={'C5'},[Status]={'Closed'},[Tracker]={'CM'}>}[Displacement time]), 'hh:mm:ss'))<='12','YES','NO'))))))

Thanks!