Forum Discussion

zhona9's avatar
zhona9
Icon for Resolver I rankResolver I
2 years ago
Solved

Calculating Year on Year % difference for quantity

I am creating a matrix table that shows the difference in export quantity from last year. I thought I followed the textbook example completely but the figure for last year derived is the same as for this year. Not sure what went wrong.

 

This is part of the data I have for my data table 'Alumina'. As I only have month and year for the data, I made a new column called DT with a date showing the first of that month:

 

I have a date table 'AluminaDate':

 

There is a one to many relationship between the two tables, linking DT to Date:

 

You can see from the table, last year's value is the same as this year's:

 

Same for the matrix table, YoY% is 0:

 

These are the measures (edit on original post, forgot to post these):

 

QtyS LY = CALCULATE(Sum(Alumina[Quantity]), SAMEPERIODLASTYEAR(AluminaDate[Date]))

YOY% = DIVIDE(SUM(Alumina[Quantity]), CALCULATE(Sum(Alumina[Quantity]), SAMEPERIODLASTYEAR(AluminaDate[Date])))-1

 

I think there must have been an obvious mistake I made, appreciate guidance. Thank you.

 

  • Managed to resolve by adding day, month, year to the calendar table and then adding a slicer for year and month. Still don't know why it works, but it does.

1 Reply

  • Managed to resolve by adding day, month, year to the calendar table and then adding a slicer for year and month. Still don't know why it works, but it does.