Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago

parallelperiod does not work for me

Hi all, 

 

I struggeling with parallel period: 

i want to get the total sales of previous month, this is the formula I use: 

 

sales previous month = CALCULATE([Sum of sales]; PARALLELPERIOD('Sales Warranty'[timeperiod date]; -1; MONTH))
 
if I use this formula, i get the total sales of all months also previous years except the sales of this month. 
 
How can I get only the sales of last month?
 
can you guys help me?

3 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi  v-yulgu-msft,

      I use a date table created with this query:

       

      Dates = var BaseCalendar = CALENDARAUTO()
      RETURN GENERATE(BaseCalendar; var Basedate = [Date] var Yeardate = YEAR( Basedate) var monthnumber = MONTH(Basedate)
        Return row("day"; Basedate = [Date];
          "Year"; Yeardate;
          "Month Number"; monthnumber;
          "Month"; FORMAT ( Basedate; "mmmm" );
          "Year Month"; FORMAT ( Basedate; "yy mmm" )))
      BR,
      Maxim