10 Replies Latest reply: Aug 3, 2016 8:13 AM by rodrigo silva RSS

    Show on a label a value regarding the current week

    Rafael Oliveira

      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_YEARDATESELL
      16-3201/08/20160
      16-3131/07/20161000
      16-3130/07/2016500
      16-3129/07/2016500
      16-3128/07/2016600
      16-3127/07/2016700
      16-3126/07/2016100
      16-3125/07/2016200
      16-3024/07/2016300
      16-3023/07/2016400
      16-3022/07/2016500
      16-3021/07/2016600
      16-3020/07/2016400
      16-3019/07/2016300
      16-3018/07/2016400
      16-3017/07/2016800

       

      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.