Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Parallelperiod not working as expected

Hello, 

With Covid 19 , I am trying to compare monthly "numbers" with the ones from last year but also from the same period in 2019 ...

 

My table is only 2 columns : date & number1 

I am adding a column number2 

 = CALCULATE(SUM(MyTable[number1]), PARALLELPERIOD(MyTable[Date],( ( 2019 - year(MyTable[Date]) ) * 12) ,MONTH) )
 
but il only returns data for 2019 !!! Any idea of my mistake ?
 

 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi  Anonymous ,

    Here are the steps you can follow:

    1. Create calculated column.

    number2 =
    var _current='Table'[number1]
    var _last=CALCULATE(SUM('Table'[number1]),FILTER(ALL('Table'),'Table'[Date]=DATE( YEAR(EARLIER('Table'[Date]))-1,MONTH(EARLIER('Table'[Date])),DAY(EARLIER('Table'[Date])))))
    return
    _current-_last

    2. Result:

    If I have misunderstood your meaning, please provide your desired output and your pbix file without privacy information.

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

7 Replies

  • Samarth_18's avatar
    Samarth_18
    Community Champion

    Hi Anonymous ,

     

    Try to use calender date table in PARALLELPERIOD.

     

    Thanks,

    Samarth

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hello, you mean the calendar date that I use as "date" reference in my Power BI ? 

      Calendrier =
      ADDCOLUMNS(
      CALENDAR(DATE(2019,01,01), TODAY()),
      "Année" , year([Date]),
      "Année Trimestre", Year([Date]) & "-Q" & Format([Date], "q"),
      "Année Mois" , FORMAT([date],"YYYY MM"),
      "Num Mois", FORMAT ( [Date], "MM" ),
      "Mois", FORMAT([date],"MMMM"),
      "Semaine", WEEKNUM([Date]),
      "Trimestre", "Q" & FORMAT ( [Date], "Q" ),
      "YearMonthShort", FORMAT ( [Date], "YYYY/mmm" ),
      "MonthNameShort", FORMAT ( [Date], "mmm" ),
      "DayOfWeekNumber", WEEKDAY ( [Date] ),
      "DayOfWeek", FORMAT ( [Date], "dddd" ),
      "DayOfWeekShort", FORMAT ( [Date], "ddd" )
      )
  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  Anonymous ,

    Here are the steps you can follow:

    1. Create calculated column.

    number2 =
    var _current='Table'[number1]
    var _last=CALCULATE(SUM('Table'[number1]),FILTER(ALL('Table'),'Table'[Date]=DATE( YEAR(EARLIER('Table'[Date]))-1,MONTH(EARLIER('Table'[Date])),DAY(EARLIER('Table'[Date])))))
    return
    _current-_last

    2. Result:

    If I have misunderstood your meaning, please provide your desired output and your pbix file without privacy information.

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly