7 Replies Latest reply: Jan 21, 2016 8:24 AM by tulasiram b

# week as dimension and show only last 12 weeks

Hi Frnz,

I need to show last 12 Weeks sales. Here Week as Dimension, already i have week Filed.

• ###### Re: week as dimension and show only last 12 weeks

Hi Can you share sample data ?\

-Nagarjuna

• ###### Re: week as dimension and show only last 12 weeks

You could use a condition within the dimension or the expression like:

sum({ YearWeek = {">=\$(=max(YearWeek)-12)"}>} Sales)

that requires an appropriate field within a master-calendar. Possible is also to use a flag for these period. Many helpful links could you find here: How to use - Master-Calendar and Date-Values

- Marcus

• ###### Re: week as dimension and show only last 12 weeks

you can use a set analysis in your expression.

SUM({<DATE_FIELD={"\$(='>=' & Date(Today()-84))"}>} SALES_FIELD)

• ###### Re: week as dimension and show only last 12 weeks

if your week field as number, may be try this..

=sum({<Week={'>=\$(=max(Week,12))'}>}sales)

• ###### Re: week as dimension and show only last 12 weeks

Couple of ways you can add only 12 weeks of data.

1. Add new field in the Master Calendar WeekNumber having 1, 2,3 4, 5, 6 .... for ascending week Number.

Simply add calculated dimension: IF( WeekNumber >= Max(WeekNumber)-12 , WeekNumber )

or

Sum({<WeekNumber={">=\$(=Max(WeekNumber)-12<=\$(=Max(WeekNumber)"}>} Sales)