6 Replies Latest reply: Aug 14, 2014 4:32 AM by Stian Karlsen RSS

    Variable / set analysis

      Hi, I need some help to understand something with my variable and how it works.


      I have two variables one to set the week and one to to set month.


      The variables are defined in the script and looks like this.


      let vTodayWeek = week(Today());

      let vTodayMonth = Month(Today());


      In the Variable Overview i get 33 and aug  as my week and month. So it seems to work fine.


      Then here comes the challange.


      I then want to create a new variable to display data for the current week and month and in some cases for the past week and past month.


      For the week I have done like this and it works like I want it to, I can now just adjust the 0 to a 1 and get the past week :


      sum({$<År = {$(=max(År))},Uke={$(=vTodayWeek-$1)},Team={'$2'}>}SCORE_SP1)


      sum({$<År = {$(=max(År))},Uke={$(=vTodayWeek-$1)},Team={'$2'}>}Teller)/100


      and my expression looks like this: =num($(vExprKTIValueTeamWeek1(0,REK TEAM)),'#,##0.0%')  (current week)

      num($(vExprKTIValueTeamWeek1(1,REK TEAM)),'#,##0.0%')  (past week)


      ***For month on the other hand, I can't make it work,****


      sum({$<År = {$(=max(År))},Uke={$(=vTodayMonth-$1)},Team={'$2'}>}SCORE_SP1)


      sum({$<År = {$(=max(År))},Uke={$(=vTodayMonth-$1)},Team={'$2'}>}Teller)/100


      and my expressions looks like this: =num($(vExprKTIValueTeamMonth(0,REK TEAM)),'#,##0.0%') (should be current month)

      =num($(vExprKTIValueTeamMonth(1,REK TEAM)),'#,##0.0%') (should be past month)


      What am I doing wrong with the month? And what must I do to correct it?