Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

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?

Capture.JPG

1 Solution

Accepted Solutions
Gysbert_Wassenaar

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))


talk is cheap, supply exceeds demand

View solution in original post

5 Replies
Gysbert_Wassenaar

try using the mod function:

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


talk is cheap, supply exceeds demand
jagan
Luminary Alumni
Luminary Alumni

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.

Not applicable
Author

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?

Capture.JPG

Gysbert_Wassenaar

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))


talk is cheap, supply exceeds demand
Not applicable
Author

Hi, great, the 2nd one did the trick

thanks again