For the first set of date patterns, we are going to look at some DAX expressions to create measures that will compare values over equivalent periods. The first of these will give the total sales quantity for the same period of the previous year.
The following expression will create a measure called Sales Quantity PY that will give the total sales quantity for the equivalent date in the previous year:
Sales Quantity PY =CALCULATE ( SUM ( Sales[Sales Quantity] ), SAMEPERIODLASTYEAR ( 'Date Table'[Date] ))
Figure 11-8 shows this measure being used to create a graph showing a comparison of sales quantity with the same period for the previous year: