Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Criei um painel de precificação, onde através de uma consulta SQL são buscados valores no banco de dados a partir de um número de atendimento. esses valores podem estar e Dólar, em Real ou ambos.
Preciso criar um mecanismo onde, quando eu filtrar um atendimento e existirem valores em Real e Dólar, apenas os valores em Real sejam exibidos. Ou seja, ele só irá me exibir valores em Dólar quando NÃO houver um valor em Real para aquele atendimento.
Exemplo do chamado 228859 no print, onde está mostrando os valores nas duas moedas quando eu só preciso, neste caso dos valores em Reais.
Acredito que eu deva usar um comando CASE, mas não estou conseguindo ver essa estrutura.
Hi @paulokpk ,
I'm making some assumptions about your data here and that you want to omit the US$ from your data completely, but if "Atendimento" is your key and there is only one number per combination of "R$" and "US$" then you could use the Exists() function to sort our your "US$" rows in your load script.
For example:
data:
load
ATENDIMENTO as AtendimentoCheck,
*
from YourData
where MOEDA = 'R$';
concatenate(data)
load
*
From YourData
where not exists(AtendimentoCheck, ATENDIMENTO);
drop field AtendimentoCheck;
The first load of your data will only bring in the rows (ATENDIMENTO) that have a REAL amount.
The second load will check every ATENDIMENTO that has been loaded previously and discard them leaving you with only the records have a US$ only.
I added AtendimentoCheck just in case Atendimento had been added previously with all data. The "Not Exists()" function won't work if it has been previously loaded and it was looking at Atendimento only.
I hope these assumptions are correct and is helpful.
Thanks
Anthony