Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

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. 

1 ACCEPTED SOLUTION
Ritaf1983
Super User
Super User

Hi @Anonymous 
To show both years in this case you should use the date table + time intelligence functions.

Ritaf1983_0-1700289018462.png

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 :
Ritaf1983_1-1700289305139.png

Result:

Ritaf1983_2-1700289471900.png

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

 

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

1 REPLY 1
Ritaf1983
Super User
Super User

Hi @Anonymous 
To show both years in this case you should use the date table + time intelligence functions.

Ritaf1983_0-1700289018462.png

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 :
Ritaf1983_1-1700289305139.png

Result:

Ritaf1983_2-1700289471900.png

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

 

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors