Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Good afternoon , I have to make a report that shows on a label the sale of the current week and the other the sale of the previous week. But the week we use is not the same as Week, WeekName .. functions . I need something like this query .
Select semana_ano, sum(qtd) from tabela where semana_ano = (select semana_ano from calendario where data = currentdate()).
Example:
WEEK_YEAR | DATE | SELL |
---|---|---|
16-32 | 01/08/2016 | 0 |
16-31 | 31/07/2016 | 1000 |
16-31 | 30/07/2016 | 500 |
16-31 | 29/07/2016 | 500 |
16-31 | 28/07/2016 | 600 |
16-31 | 27/07/2016 | 700 |
16-31 | 26/07/2016 | 100 |
16-31 | 25/07/2016 | 200 |
16-30 | 24/07/2016 | 300 |
16-30 | 23/07/2016 | 400 |
16-30 | 22/07/2016 | 500 |
16-30 | 21/07/2016 | 600 |
16-30 | 20/07/2016 | 400 |
16-30 | 19/07/2016 | 300 |
16-30 | 18/07/2016 | 400 |
16-30 | 17/07/2016 | 800 |
I need to create a label that has , for example.... IF TODAY IS 29/07, this label should add the SALES days 31,30,29,28,27,26,25 , ie all dates of the week 16-31 , which is the week regarding the day ( 29/07 ) .
In another label you must be the sale of the previous week , ie if today is 29/07 , week 16-31 , will show the sum of sales days regarding the week 16-30 ( last week )
Thanks a lot for the help.
Note: Title translated to English by Community Moderator as a courtesy.
Isso ai!
Faça esse if em uma variável e use a variável no set analisys.
Por favor marque uma das respostas como correta se uma delas te atendeu para manter a comunidade organizada.