Forum Discussion
matrix
i have this year sales and last year sales in a matrix category wise. and i have added a date range slicer in which is of this year and i am not able to show last year sales in that matrix.
Hi Anonymous
To show both years in this case you should use the date table + time intelligence functions.Basic measure ( can be used as a current year)
total_sales = sum('Table'[Sales])Measure for the previous year:PY sales = CALCULATE([Quotes#],SAMEPERIODLASTYEAR('Calendar'[Date]))Marking calendar as a date table :Result:
Pbix is attached
More detailed tutorial to creating dates table:
https://www.datacamp.com/tutorial/how-to-create-date-tables-in-power-bi-tutorial
More detailed tutorial to YOY calculations:
https://www.youtube.com/watch?v=J4h17Kqyj4M
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
1 Reply
- Ritaf1983Super User
Hi Anonymous
To show both years in this case you should use the date table + time intelligence functions.Basic measure ( can be used as a current year)
total_sales = sum('Table'[Sales])Measure for the previous year:PY sales = CALCULATE([Quotes#],SAMEPERIODLASTYEAR('Calendar'[Date]))Marking calendar as a date table :Result:
Pbix is attached
More detailed tutorial to creating dates table:
https://www.datacamp.com/tutorial/how-to-create-date-tables-in-power-bi-tutorial
More detailed tutorial to YOY calculations:
https://www.youtube.com/watch?v=J4h17Kqyj4M
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly