Forum Discussion

melg's avatar
melg
Frequent Visitor
4 years ago

Parallel Period producing the same result as current period

Hi there,

 

I have created the below expression to populate a line graph. This works perfectly for the current period. 

 

Gross Deals Posted =
SWITCH(
       SELECTEDVALUE('Grouping'[Group]),
          "Posted Deals",
                [Posted Deals 13Months],
          "Posted Gross",
                [Posted Gross 13Months]
)

 

However, when I try to work out the values for the previous period, using parallel period, it does not seem to work. 

 

Gross Posted Deals 1YR =
CALCULATE([Gross Deals Posted],
                PARALLELPERIOD(pavw_Dates[ReportingDate].[Date],
                -12,
                MONTH)
                 )
 
This expression calculates the same value as the current period.
 

 

I turned this into a table to see more clearly. 

 

 

Any help would be greatly appreciated. 

Thank you.

Melanie 

 

5 Replies

  • melg , You should use Date table for that

     

    Gross Posted Deals 1YR =
    CALCULATE([Gross Deals Posted],
    SAMEPERIODLASTYEAR('Date'[Date],
    -12,
    MONTH)
    )

    or

    Gross Posted Deals 1YR =
    CALCULATE([Gross Deals Posted],
    SAMEPERIODLASTYEAR('Date'[Date])
    )

    or

    Gross Posted Deals 1YR =
    CALCULATE([Gross Deals Posted],
    dateadd('Date'[Date],
    -12,
    MONTH)
    )

     

    Why Time Intelligence Fails - Power bi 5 Savior Steps for TI: https://youtu.be/OBf0rjpp5Hw

    • melg's avatar
      melg
      Frequent Visitor

      Hi there, thank you for your response!

      I tried both the SAMEPERIODLAST YEAR and DATEADD and it produces the same result, however this time there is only a value populating for October....

       

      I am using ReportingDate from my date table called pavw_Dates.

       

       

      Thanks. 

  • mahoneypat's avatar
    mahoneypat
    Icon for Microsoft Employee rankMicrosoft Employee

    Please share your [Posted Deals 13Months] measure.  I suspect that is undoing what you are trying to do with the time intelligence functions.

     

    Pat

     

    • melg's avatar
      melg
      Frequent Visitor

      Hi there,

       

      Posted Deals 13Months =
      VAR
      LDate = MAX(pavw_Dates[ReportingDate])
      VAR
      FDate = EOMONTH(LDate,-13)
      VAR
      Result =
      IF(
      MAX(FilterDates[ReportingDate]) <=
      LDate &&
      MIN(FilterDates[ReportingDate]) >=
      FDate,
      CALCULATE(
      [Posted Deals],
      FILTER(ALL(pavw_Dates[MonYear]),
      pavw_Dates[MonYear] =
      VALUES(FilterDates[MonYear])
      )
      )
      )
      RETURN
      Result
       
       
      The reason I did this was to be able to show 13 months on the graph, no matter what month was selected in the slicer. This date slicer is using the pavw_Dates table.
       
      Also as part of this process, I created another date table called FilterDates:
      FilterDates = pavw_Dates
       
      This was so the graph would work correctly showing the 13 months, so in my Axis, I have the MonthYear from the FilterDates table.
       
      I hope that makes sense.
       
      Thanks.