Power BI - ORA-01843: not a Valid Month

Asked

Viewed 839 times

-1

I am making a query in PBI via a View. However, no matter how much I modify the date format, it does not accept.

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 To_date also, in various ways. I’ve looked at the region in PBI, it’s in Brazil. I don’t know what else to do, because I need to determine the date range to reduce the lines that PBI will consult.

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 date Where, as I’m sorting by Year, I made a simpler Where and he picked up all the dates of the year.

:)

  • Its original error must have 'DEZ' when the configuration of bank nls or Section is in English probably in the case would be 'DEC'. An output would be between to_date('01/01/2018', 'DD/MM/YYYY') and TO_DATE('31/12/2018', 'DD/MM/YYYY')

Browser other questions tagged

You are not signed in. Login or sign up in order to post.