Forum Discussion

Marcin's avatar
Marcin
Icon for Helper V rankHelper V
7 years ago

12 month sum vs time filter

Hi,

 

I know that this topis was discussed many time but I am struggling with this problem.

 

I use data from ContosoRetailDW base as a demo, I would like to built measue calculatin sum of last 12 months ( currrent inculded )

 

I would also to present this data in 12 month range visuals beteween max date ( set manually ) - 12 months. 

 

I have created a measure like this, with ALL function to be able to see proper SUM while using Date filter. 

 

Last 12M sales amount = CALCULATE([Sales amount],ALL(DimDate[Datekey]),DATESINPERIOD(DimDate[Datekey].[Date],LASTDATE(DimDate[Datekey].[Date]),-1,YEAR))
 
But I have two problems:
 
First when I filter by TimeYear = 2009 I got also calculation 2010 
Second for January 2009 I would like to get SUM of 2008 too. 
 
 
Is the any possibility to publish pbx file here ? 

3 Replies