5 Replies Latest reply: Nov 19, 2012 9:00 AM by Tim Hop

# Problem with week numbers

Hi All,

I have a straight table which i am forcasting figures for 10 weeks.

I have a seperate calendar for my weekly forcast and i have set up variables for the 10 weeks. i.e.

vWeekSelection = ForecastCal_Week

vWeekSelection+1 = ForecastCal_Week+1

vWeekSelection+2 = ForecastCal_Week+2

etc

the problem i am having is with the expression labels of the chart.

for each label i am using the variable.

so if i select the current week (46), i get the correct week numbers up to 52, but then the next expression lable is showing 53 when i want it to go back to 1

Does anyone know what i can do to correct this please?

• ###### Re: Problem with week numbers

try using the mod function:

vWeekSelection+1 = mod(ForecastCal_Week+1,52)

• ###### Re: Problem with week numbers

Hi, i have just noticed a problem with your solution..

if i select week 46 for example, i get 47,48,49,50,51,0. it doesnt show me 52

Do you know what the problem could be?

• ###### Re: Problem with week numbers

try:

vWeekSelection+1 = ceil(mod((ForecastCal_Week+1)*10,521)/10)

or

vWeekSelection+1 = if(mod(ForecastCal_Week+1,52)=0,52,mod(ForecastCal_Week+1,52))

• ###### Re: Problem with week numbers

Hi, great, the 2nd one did the trick

thanks again

• ###### Re: Problem with week numbers

Hi,

Instead of writing multiple expressions you can do that in single expression, if you have date and week fields in your data model then

=Sum({<DateDimension={'>=\$(=WeekStart(Max(DateDimension), -10))<=\$(=Max(DateDimension))'}>} Sales)

In the above expression replace DateDimension with you dimension name and Sales with your field.

Hope this helps you.

Regards,

Jagan.