Power BI - ORA-01843: not a valid month

0

I'm doing a PBI query through a View. However, no matter how I modify the date format, it does not.

The View is below:

select 
    NROREPRESENTANTE AS CodRepresentante, 
    nroempresa,
    seqcliente,
    skcategoria,
    count(distinct seqnf) as "Clientes Total", 
    sum(qtdoperacao) as "Produtos Vendidos", 
    sum(vlroperacao) as "Venda Total",
    sum(vlrctobruto) as "Custo Bruto",
    sum(vlroperacao*ind_promocao) as VLR_PROMOCAO,
    TO_char(DATA, 'DD/MON/YYYY') as DOPER
    from dwv_venda
where DATA between to_date('01/JAN/2018', 'DD/MON/YYYY') and 
TO_DATE('31/DEZ/2018', 'DD/MON/YYYY')
and acmcompravenda = 'S'
group by data, NROREPRESENTANTE, NROEMPRESA, seqcliente, skcategoria
order by data, NROREPRESENTANTE, NROEMPRESA, seqcliente, skcategoria

I've tried To_date too, in several ways. I already looked at the region in PBI, it is in Brazil. I do not know what I'm doing anymore, because I need to determine the date range to narrow the lines that the PBI will consult.

    
asked by anonymous 27.12.2018 / 15:44

1 answer

0

Fixed.

select 
  NROREPRESENTANTE AS CodRepresentante, 
  nroempresa,
  seqcliente,
  skcategoria,
  count(distinct seqnf) as "Clientes Total", 
  sum(qtdoperacao) as "Produtos Vendidos", 
  sum(vlroperacao) as "Venda Total",
  sum(vlrctobruto) as "Custo Bruto",
  sum(vlroperacao*ind_promocao) as VLR_PROMOCAO,
  data
from dwv_venda
where **to_char(data, 'yyyy') = '2018'**
and acmcompravenda = 'S'
group by data, NROREPRESENTANTE, NROEMPRESA, seqcliente, skcategoria
order by data, NROREPRESENTANTE, NROEMPRESA, seqcliente, skcategoria

He was having some trouble reading the Where of date, as I'm sorting by Year, I made a simpler where and he picked up all the dates of the year.

:)

    
27.12.2018 / 16:17