2 Replies Latest reply on Dec 14, 2016 12:24 PM by Jaime Lego

# Renumbering dates to start at first week of sales

Hello,

I have been working on this problem for quite some time, so I'd appreciate any help.

I have sales of a product that starts on different weeks depending on the territory. I'd like to even out the sales so that the first week for each territory is week #1 (the orange bars below). Then the weeks after that would continue as week 2, week 3, etc.

The only fix I've come up with is manually numbering the weeks within my data source. I'd like to come up with a formula that disregards the weeks preceding the first week of sales and then continues numbering the weeks from there.

• ###### 1. Re: Renumbering dates to start at first week of sales

Hi Jaime,

You should be able to do this with an LOD expression. First, we need to find the date of the very first purchase. The expression below does this by finding the minimum date of the whole data set (represented by { }).

This is equivalent to { FIXED : MIN([Order Date]) }

Now that you know when purchases started, you can then calculate the difference, in weeks, between that first purchase and any subsequent ones:

And then you're all set! Use this new calculated field on any viz!

Hope this helps!

2 of 2 people found this helpful
• ###### 2. Re: Renumbering dates to start at first week of sales

Thank you so much Santiago! This solved my problem perfectly.