Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Not applicable

Logic Problem

Hii to all,

I am sharing a problem  and hope that someone will solve it.

I want the count of those employee who are active 'ac' in 2012 and whose promotion flage is 'F' for the last three consecutive year. i am also attaching an application file where i got the result, but there i am also getting f employee whose promotion flag is not 'F' for last three consecutive year.I want to exclude that employee against which promotion flag 'F' is maintained for last three years

1 Solution

Accepted Solutions
MVP
MVP

Re: Logic Problem

Try maybe something like

=count(

{<

Emp = p({<Year={"$(vmaxyear)"},Active={'ac'}>}Emp)

     * {"=count({<Promotion = {f}, Year={'>=$(vmaxyear_3)'}>}distinct Year)=3"}

>}

distinct Emp)

5 Replies
MVP
MVP

Re: Logic Problem

Try maybe something like

=count(

{<

Emp = p({<Year={"$(vmaxyear)"},Active={'ac'}>}Emp)

     * {"=count({<Promotion = {f}, Year={'>=$(vmaxyear_3)'}>}distinct Year)=3"}

>}

distinct Emp)

Not applicable

Re: Logic Problem

Emp Name FinFlagPromotionActive
1a2008fac
1a2009fac
1a2010fna
1a2011fac
1a2012fac
2b2008fac
2b2009tac
2b2010tac
2b2011fac
2b2012fac
3c2008fac
3c2009tac
3c2010fac
3c2011fac
3c2012fac
4d2008fac
4d2009fac
4d2010fac
4d2011fac
4d2012fac
5e2008tna
5e2009tna
5e2010tac
5e2011fac
5e2012fac
6f2008ac
6f2009ac
6f2010fac
6f2011fac
6f2012fac

Now my data look as above format.I want only those employee who are active in 2012 and Promotion is 'f' for last three year.

MVP
MVP

Re: Logic Problem

You just need to rename field FinFlag to Year and adapt your two variable definitions to the different Year format.

Not applicable

Re: Logic Problem

I don't understand what r u saying. It is my humble request to u to develop the test application based on my given data and requirement.

MVP
MVP

Re: Logic Problem

Data:

LOAD Emp,

     Name,

    FinFlag as Year,

     Promotion,

     Active

FROM

[.\empTest2.xlsx]

(ooxml, embedded labels, table is Sheet2);

Variable definitions:

vmaxyear:          =max(Year)

vmaxyear_3:      =max(Year)-2