Calculated Column to show previous month or previous row

Hi Sam,

I would like to create a calculated column to show the previous month value. Not a measure but a calculated column. Are you able to please suggest a method?
I am pulling in the data from excel which is has a relationship with a date table and metric dimension table. The below table is the fact table. The column I am trying to create is the Previous month and Calculated column.
Thanks in advance.

@ElizabethTachjian,

I would suggest tackling this in two parts:

  1. Use the EARLIER function to address the prior row context issue.

http://portal.enterprisedna.co/courses/dax-formula-deep-dives/lectures/6775377

  1. Wrap a CALCULATE( IF () ) statement around the EARLIER portion of the calculation to do the reset on Metric Name.

If you look at post #7 in this thread, it provides an example of how to do this:

Calculating Difference Between Dates in Same Column with Multiple Events on Same Day - #7 by BrianJ

EARLIER isn’t used much anymore since the introduction of variables to DAX, but this seems like a textbook application of it, particularly for a calculated column.

I hope this is helpful.

  • Brian

Thank you!