Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
ernestolmalves
Contributor III
Contributor III

Total de funcionários ativos

Estou abrindo outra discussão e fechando a anterior para tentar facilitar o que preciso.

No qvf em anexo tem a base de dados e a tabela abaixo é o resultado que preciso conseguir.

Até agora, não descobri como fazer a extração com esses resultados.

 

PeriodoAdmDem Func
jan/1820020
fev/1832052
mar/1824175
abr/1814089
mai/18171105
jun/18201124
jul/18160140
ago/18233160
set/18155170
10/201810171

Agradeço desde já quem puder dar uma luz sobre essas questões.

Abraços,

1 Solution

Accepted Solutions
mario_ti
Creator
Creator

Ernesto,

Boa Tarde

Cria um intervalo de datas, entre o DATAADM e DATADEM, e uma FLAG se estava ativo ou não .. dai consegues criar usando set analysis ...Basicamente isso:

INTERVALO: 

LOAD 

  %CHAVE,

  CODIGOFUNCPESSOA,

  DATAADM,

  DATADEM,

  If(DATADEM = (Date( DATAADM + IterNo() - 1 )),'0','1') AS FLAG,

  Date( DATAADM + IterNo() - 1 ) as 'Data' 

While DATAADM + IterNo() - 1 <= if(IsNull(DATADEM),Today(), DATADEM); 

PESSOAL:

LOAD

    %CHAVE,

    CODIGOFUNCPESSOA,

    DATAADM,

    DATADEM,

    FUNCATIVO

FROM [lib://Transformados/QT_TEMPFUNC.qvd]

(qvd)

where

;

Dai usando o set analysis:

Count({$<FLAG={'1'}>}distinct CODIGOFUNCPESSOA)

-

Count({$<FLAG={'0'}>}distinct CODIGOFUNCPESSOA)

Tens o total de ativo!

View solution in original post

8 Replies
OmarBenSalem

Next time, please try to write in english .

With that being said, here u go :

Func:

aggr(

Rangesum(Above(

Sum(aggr(count(if([Periodo.Cal.Ano Mês] >= [DATAADM.Cal.Ano Mês]

and ([Periodo.Cal.Ano Mês] <= [DATADEM.Cal.Ano Mês])

                or isnull([Periodo.Cal.Ano Mês])

                , [%CHAVE] ))

, [%CHAVE], [Periodo.Cal.Ano Mês], CODIGOFUNCCONTR ))

,0,rowno()))

,(Periodo,(Numeric,Ascend)))

result:

Capture.PNG

ernestolmalves
Contributor III
Contributor III
Author

Hi Omar,


You're right, sorry.

Your suggestion is very good!

It helps me in the case of the table, however, I would really like to have a solution to a question like:

How many admissions, dismissals and assets in May / 2018? No need to set up a table for this.


Anyway, for a table, your idea helps a lot!


Thank you !

OmarBenSalem

In a KPI?

Well then just do sthing as follow:

count({<Year,Month,Date={"<=$(=max(Date))"}>}UrMeasure)

Hiope this helps

ernestolmalves
Contributor III
Contributor III
Author

Why this not work ?

count({<[DATAADM.Cal.Ano],[DATAADM.Cal.Mês],DATAADM={"<=$(=max([Periodo.Cal.Ano Mês]))"}>}CODIGOFUNCCONTR)

Or 

count({<[DATAADM.Cal.Ano],[DATAADM.Cal.Mês],DATAADM={"<=$(=("01/2018"))"}>}CODIGOFUNCCONTR)

OmarBenSalem

it's Date={"<=$(=max(Date))"} not month

ernestolmalves
Contributor III
Contributor III
Author

DATAADM={"<=$(=max("01/01/2018"))"} ? Not work too.

Date is DATAADM or DATADEM, right ?

I need to compare DATAADM with PERIODO.

mario_ti
Creator
Creator

Ernesto,

Boa Tarde

Cria um intervalo de datas, entre o DATAADM e DATADEM, e uma FLAG se estava ativo ou não .. dai consegues criar usando set analysis ...Basicamente isso:

INTERVALO: 

LOAD 

  %CHAVE,

  CODIGOFUNCPESSOA,

  DATAADM,

  DATADEM,

  If(DATADEM = (Date( DATAADM + IterNo() - 1 )),'0','1') AS FLAG,

  Date( DATAADM + IterNo() - 1 ) as 'Data' 

While DATAADM + IterNo() - 1 <= if(IsNull(DATADEM),Today(), DATADEM); 

PESSOAL:

LOAD

    %CHAVE,

    CODIGOFUNCPESSOA,

    DATAADM,

    DATADEM,

    FUNCATIVO

FROM [lib://Transformados/QT_TEMPFUNC.qvd]

(qvd)

where

;

Dai usando o set analysis:

Count({$<FLAG={'1'}>}distinct CODIGOFUNCPESSOA)

-

Count({$<FLAG={'0'}>}distinct CODIGOFUNCPESSOA)

Tens o total de ativo!

ernestolmalves
Contributor III
Contributor III
Author

Valeu Mario ! Deu certo aqui !

Obrigado !

Omar, thanks a lot for your help !