Quantcast
Channel: SQLServerCentral » Data Warehousing » Analysis Services » Latest topics
Viewing all articles
Browse latest Browse all 1341

MDX Calculation for MTD comparison to last year, but only for stores that were active both years

$
0
0
I need to compare MTD numbers (and other time periods such as last 4 weeks, YTD) to last year, but only want to include sales in the current period for stores that were open for the full period last year.For example:This year MTD: 12/1/2014 - 12/3/2014Last year MTD: 12/1/2013 - 12/3/2014Stores 1 and 2 were opened on 11/1/2013, but store 3 opened on 12/3/2014 so it's data will be omitted from the calculation.[code="sql"]Store Date Units1 12/1/2013 32 12/1/2013 61 12/2/2013 22 12/2/2013 81 12/3/2013 42 12/3/2013 73 12/3/2013 111 12/1/2014 32 12/1/2014 63 12/1/2014 91 12/2/2014 42 12/2/2014 63 12/2/2014 91 12/3/2014 42 12/3/2014 73 12/3/2014 10 CY LY [+/-]Store 1: 11 9 [+2]Store 2: 19 21 [-2]Store 3: 19 28 [N/A] --N/A because it wasn't open for the full MTD period last year.[/code]I came up with a method to accomplish this with a stored procedure, but I'd like to utilize MDX calculations (similar to the Time Intelligence Wizard output) right in the cube.Has anyone worked on something similar?

Viewing all articles
Browse latest Browse all 1341

Trending Articles