Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Pessoal,
Preciso montar um relatorio que me diga apenas quando o custo sofreu variação, ou seja, apenas a ultima data e o custo que o produto sofreu variação de preço.
Assim vou saber analisar dentro de um determinado periodo quais foram as oscilações no custo do produto e qual data mudou.
No exemplo abaixo, até o dia 25/01/2007 o custo era 6,46, depois mudou no dia 13/02/2007 para 7,10...e assim por diante.
Problema
PRODUTO | MOV_DATA | CUSTO |
3426 | 12/01/2007 | 6,46 |
3426 | 25/01/2007 | 6,46 |
3426 | 13/02/2007 | 7,1 |
3426 | 02/03/2007 | 7,78 |
3426 | 26/03/2007 | 7,1 |
3426 | 11/04/2007 | 6,46 |
3426 | 30/04/2007 | 6,47 |
3426 | 24/05/2007 | 7,1 |
Solução
PRODUTO | MOV_DATA | CUSTO |
3426 | 25/01/2007 | 6,46 |
3426 | 13/02/2007 | 7,1 |
3426 | 02/03/2007 | 7,78 |
3426 | 26/03/2007 | 7,1 |
3426 | 11/04/2007 | 6,46 |
3426 | 30/04/2007 | 6,47 |
3426 | 24/05/2007 | 7,1 |
Caso alguem tenha uma ideia, desde ja agradeço.
att,
André Tonini
Que tal isso:
Problema:
Load * Inline [
PRODUTO, MOV_DATA, CUSTO
3426, 12/01/2007, 6.46
3426, 25/01/2007, 6.46
3426, 13/02/2007, 7.1
3426, 02/03/2007, 7.78
3426, 26/03/2007, 7.1
3426, 11/04/2007, 6.46
3426, 30/04/2007, 6.47
3426, 24/05/2007, 7.1
];
Load
*,
If(Peek(CUSTO)<>CUSTO AND Peek(PRODUTO)=PRODUTO,'S','N') AS FLAG_VARIACAO,
If(Peek(CUSTO)<>CUSTO AND Peek(PRODUTO)=PRODUTO,Peek(CUSTO),CUSTO) AS CUSTO_ANTERIOR
Resident Problema;
DROP TABLE Problema;
Resultado
Qlikview ou Qlik Sense?
Clever Boa tarde é qlikview
Att
André
Que tal isso:
Problema:
Load * Inline [
PRODUTO, MOV_DATA, CUSTO
3426, 12/01/2007, 6.46
3426, 25/01/2007, 6.46
3426, 13/02/2007, 7.1
3426, 02/03/2007, 7.78
3426, 26/03/2007, 7.1
3426, 11/04/2007, 6.46
3426, 30/04/2007, 6.47
3426, 24/05/2007, 7.1
];
Load
*,
If(Peek(CUSTO)<>CUSTO AND Peek(PRODUTO)=PRODUTO,'S','N') AS FLAG_VARIACAO,
If(Peek(CUSTO)<>CUSTO AND Peek(PRODUTO)=PRODUTO,Peek(CUSTO),CUSTO) AS CUSTO_ANTERIOR
Resident Problema;
DROP TABLE Problema;
Resultado
Boa noite,
Alguma novidade sobre o assunto?
Se alguma resposta lhe serviu para solucionar seu questionamento, por favor, feche a thread e compartilhe conosco a solução.
Abs e Sucesso!