Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
pedroivo
Creator
Creator

Alterar o nome do campo de auto calendário

Bom dia comunidade,

estou precisando de ajuda na formatação da coluna que usa a informação de auto calendário demonstrado abaixo:

[autoCalendar]:

  DECLARE FIELD DEFINITION Tagged ('$date')

FIELDS

  Dual(Year($1), YearStart($1)) AS [Year] Tagged ('$axis', '$year'),

  Dual('Q'&Num(Ceil(Num(Month($1))/3)),Num(Ceil(NUM(Month($1))/3),00)) AS [Quarter] Tagged ('$quarter', '$cyclic'),

  Dual(Year($1)&'-Q'&Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [YearQuarter] Tagged ('$yearquarter', '$qualified'),

  Dual('Q'&Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [_YearQuarter] Tagged ('$yearquarter', '$hidden', '$simplified'),

  Month($1) AS [Month] Tagged ('$month', '$cyclic'),

  Dual(Year($1)&'-'&Month($1), monthstart($1)) AS [YearMonth] Tagged ('$axis', '$yearmonth', '$qualified'),

  Dual(Month($1), monthstart($1)) AS [_YearMonth] Tagged ('$axis', '$yearmonth', '$simplified', '$hidden'),

  Dual('W'&Num(Week($1),00), Num(Week($1),00)) AS [Week] Tagged ('$weeknumber', '$cyclic'),

  Date(Floor($1)) AS [Date] Tagged ('$axis', '$date', '$qualified'),

  Date(Floor($1), 'D') AS [_Date] Tagged ('$axis', '$date', '$hidden', '$simplified');

DERIVE FIELDS FROM FIELDS [DATA DE VINCULO], [DATA DE DESLIGAMENTO], [COMPETENCIA], [MAIOR COMPETENCIA] USING [autoCalendar] ;

Na segunda tabela dinâmica inclui a coluna [COMPETENCIA.autoCalendar.Quarter], que esta sendo exibido com o label Q1, Q2, Q3 e Q4. Gostaria que fosse exibido 1/ano, 2/ano, 3/ano e 4/ano, por exemplo 1/2017, 2/2017, ....

Deixando como default o último ano carregado.

Como posso fazer isso?

AUTOCALENDARIO.png

7 Replies
Marcio_Campestrini
Specialist
Specialist

Pedro

Substitua a linha


Dual('Q'&Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [_YearQuarter] Tagged ('$yearquarter', '$hidden', '$simplified'),


Por

Dual(Num(Ceil(Num(Month($1))/3)) & Dual(Year($1), YearStart($1)) AS [_YearQuarter] Tagged ('$yearquarter', '$hidden', '$simplified'),
Márcio Rodrigo Campestrini
pedroivo
Creator
Creator
Author

Márcio,

tem algum erro na sintaxe da linha que pediu para substituir que não estou conseguindo identificar.

Marcio_Campestrini
Specialist
Specialist

Num(Ceil(Num(Month($1))/3)) & Dual(Year($1), YearStart($1)) AS [_YearQuarter] Tagged ('$yearquarter', '$hidden', '$simplified'),

Márcio Rodrigo Campestrini
pedroivo
Creator
Creator
Author

Veja:

[autoCalendar]:

  DECLARE FIELD DEFINITION Tagged ('$date')

FIELDS

  Dual(Year($1), YearStart($1)) AS [Year] Tagged ('$axis', '$year'),

  //Dual('Q'&Num(Ceil(Num(Month($1))/3)),Num(Ceil(NUM(Month($1))/3),00)) AS [Quarter] Tagged ('$quarter', '$cyclic'),

 

  Dual(Num(Ceil(Num(Month($1))/3)) & Dual(Year($1), YearStart($1)) AS [_YearQuarter] Tagged ('$yearquarter', '$hidden', '$simplified'),

 

  Dual(Year($1)&'-Q'&Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [YearQuarter] Tagged ('$yearquarter', '$qualified'),

  Dual('Q'&Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [_YearQuarter] Tagged ('$yearquarter', '$hidden', '$simplified'),

  Month($1) AS [Month] Tagged ('$month', '$cyclic'),

  Dual(Year($1)&'-'&Month($1), monthstart($1)) AS [YearMonth] Tagged ('$axis', '$yearmonth', '$qualified'),

  Dual(Month($1), monthstart($1)) AS [_YearMonth] Tagged ('$axis', '$yearmonth', '$simplified', '$hidden'),

  Dual('W'&Num(Week($1),00), Num(Week($1),00)) AS [Week] Tagged ('$weeknumber', '$cyclic'),

  Date(Floor($1)) AS [Date] Tagged ('$axis', '$date', '$qualified'),

  Date(Floor($1), 'D') AS [_Date] Tagged ('$axis', '$date', '$hidden', '$simplified');

DERIVE FIELDS FROM FIELDS [DATA DE VINCULO], [DATA DE DESLIGAMENTO], [COMPETENCIA_YYYYMM], [COMPETENCIA], [MAIOR COMPETENCIA] USING [autoCalendar] ;

Marcio_Campestrini
Specialist
Specialist

Pedro,

Conforme minha resposta anterior, retire o DUAL( da linha que te passei inicialmente.

Márcio Rodrigo Campestrini
pedroivo
Creator
Creator
Author

Funcionou perfeitamente.

mario_sergio_ti
Partner - Specialist
Partner - Specialist

Amigo;

Se possível e for o caso, marque as respostas apropriadas como Útil e/ou Correta para que outros membros possam saber que a sua pergunta foi respondida.

Referência (Tópicos 2.3 e 2.4): Manual do usuário | Como criar e gerir minhas perguntas?

Abraço.

Consultor certificado | Quem compartilha, aprende!
https://www.linkedin.com/in/mariosergioti