Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
paulinhok14
Creator
Creator

Registros duplicados de ano por data

Pessoal boa tarde,

Tenho uma tabela com vários registros e neles constam datas, segue ex:

a.png

Existem datas de vários anos, e esse campo ActualorderYear criei através da linha de script:

  • Date(Actualorderdate,'YYYY') as ActualorderYear

Porém, eu queria que ficasse um registro apenas para todas as datas do determinado ano, mas ficam vários registros para o mesmo ano, vejam um seletor dropdown para o campo de ActualorderYear:

b.png

É possível eu colocar somente um registro, onde quando eu selecionar 2006 ou até mesmo 2018 ele selecione todas as datas que correspondem ao respectivo ano?

Grato!

Labels (2)
1 Solution

Accepted Solutions
Digvijay_Singh

You should create one more field like this -

  • Year (Actualorderdate) as ActualorderYear( change name of your other field to ActualorderYearDate may be)

In your filters use this Year field. When you select any year, it will select all dates of the selected year.

The basic practice is to use master calendar table and link that table to your fact table with the Date field.

View solution in original post

6 Replies
Digvijay_Singh

You should create one more field like this -

  • Year (Actualorderdate) as ActualorderYear( change name of your other field to ActualorderYearDate may be)

In your filters use this Year field. When you select any year, it will select all dates of the selected year.

The basic practice is to use master calendar table and link that table to your fact table with the Date field.

hudson_prado
Contributor III
Contributor III

Criar um filtro para o Ano não resolveria o problema?

Assim ele traria todos os registros do ano selecionado no filtro.

Thiago_Justen_

Conforme o digvijay bem disse, o correto nesse caso seria substituir essa linha do script:

  • Date(Actualorderdate,'YYYY') as ActualorderYear

Por:

  • Year(Actualorderdate) as ActualorderYear
Thiago Justen Teixeira Gonçalves
Farol BI
WhatsApp: 24 98152-1675
Skype: justen.thiago
paulinhok14
Creator
Creator
Author

Hello man thanks for the answer.

It worked perfectly as I imagined.

Best regards!

paulinhok14
Creator
Creator
Author

Seria uma medida paleativa mas não resolveria o problema... É porque o objetivo era ter os registros em um seletor dropdown...

De qualquer maneira, obrigado pela resposta Hudson, um abraço!

paulinhok14
Creator
Creator
Author

Assim foi feito Thiago, obrigado pela resposta...

Um abraço!