Forum Discussion

sk86's avatar
sk86
New Member
3 years ago

Previous month value - wrong metadata

Hi All,

 

initial dataset is as in the upper table - Client has a certain Sale in each month, from Jan till September - belongs to Hong-Kong office, later office gets changes to London. How to write previous month sale measure, so that we could avoid what is happening in the lower table? For September, addition (artificial) row gets created with the prev mont Sale (becaue prev mont sale was in Hong-Kong), but this behaviour is really outrageus. I am interested in seeing prev mont sale, but within current month dimensionality. If I'm not mistaken, in multidimensional cube, this would never happen.

measure def: Sales_PrevMonth = CALCULATE ( SUM ( 'Fact'[Sales] ), PREVIOUSMONTH ( 'Dimension Date'[Date] ) )

 

 

 

6 Replies

  • Hi,

    Share data in a format that can be pasted in an MS Excel file.  Show the expected result in a Table format.

    • sk86's avatar
      sk86
      New Member

      Hi,

       

      here is a dataset

      Date:

      DateCalendar Month NumberCalendar Year
      2016-01-0112016
      2016-02-0122016
      2016-03-0132016
      2016-04-0142016
      2016-05-0152016
      2016-06-0162016
      2016-07-0172016
      2016-08-0182016
      2016-09-0192016
      2016-10-01102016
      2016-11-01112016
      2016-12-01122016

       

      Office:

      OfficeIDOfficeName
      1Hong-Kong
      2London
      3Warsaw
      4Barcelona
      5Delhi

       

      Client:

       

      ClientIDClientName
      1Client A
      2Client B
      3Client C
      4Client D

       

      Fact:

       

      ClientIDDateIDOfficeIDSales
      12016-01-01110
      12016-02-01120
      12016-03-01134
      12016-04-011546
      12016-05-01143
      12016-06-011324
      12016-07-01165
      12016-08-01145
      12016-09-0127
      12016-10-0126
      12016-11-0123324
      12016-12-01254

       

       

      Expected result (just one row for month 9, with both sales and prev_mont_sales in the same row, with the Office, which exists in Fact, which is London, not Hong Kong): 

       

      YearCalendar Month NumberClientNameOfficeNameSum of SalesSales_PrevMonth
      20161Client AHong-Kong10 
      20162Client AHong-Kong2010
      20163Client AHong-Kong3420
      20164Client AHong-Kong54634
      20165Client AHong-Kong43546
      20166Client AHong-Kong32443
      20167Client AHong-Kong65324
      20168Client AHong-Kong4565
      20169Client ALondon745
      201610Client ALondon67
      201611Client ALondon33246
      201612Client ALondon543324