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! Learn more

Reply
Anonymous
Not applicable

Last Year Total in Matrix

Hi,

 

I have used Matrix to have a YTD reporting in my PBI report and it is great to see the current year total can be easily displayed.

 

My question is, if my data set is like below in the second pic. How can I add an extra column right next to the current year total to show last year's total. 

 

jimmyzyrzyr_0-1610673546761.png

 

jimmyzyrzyr_1-1610673566618.png

 

 

 

1 ACCEPTED SOLUTION

Hi, @Anonymous 

 

You may remove 'Month' from 'Column'. Here is the result.

x.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

10 REPLIES 10
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

f1.png

 

You may create two measures as below.

Current cumulative = 
var m = SELECTEDVALUE('Table'[MonthNum],12)
return
CALCULATE(
    SUM('Table'[Value]),
    FILTER(
        ALLEXCEPT('Table','Table'[Type]),
        YEAR([Date])=YEAR(TODAY())&&
        'Table'[MonthNum]<=m
    )
)

 

Last cumulative = 
var m = SELECTEDVALUE('Table'[MonthNum],12)
return
CALCULATE(
    SUM('Table'[Value]),
    FILTER(
        ALLEXCEPT('Table','Table'[Type]),
        YEAR([Date])=YEAR(TODAY())-1&&
        'Table'[MonthNum]<=m
    )
)

 

Result:

f2.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Thanks for your help. Just wonder if there's a way to just show the total for the whole year and not each month?

Hi, @Anonymous 

 

You may remove 'Month' from 'Column'. Here is the result.

x.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

parry2k
Super User
Super User

@Anonymous so it should be simple measure like this:

 

LY  = CALCULATE ( SUM ( Table[Amount] ), DATEADD ( DimDate[Date], -1, YEAR ) )

 

in table visual, drop date from date dimension and LY and TY measures and you will get the result.

 

Check my latest blog post Year-2020, Pandemic, Power BI and Beyond to get a summary of my favourite Power BI feature releases in 2020

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

I have tried this way however it gives me extra things which I don't really need as you can see below (1) LY comparison for every month (2) "LYSP 000's" has include all year data to compare a YTD data

jimmyzyrzyr_0-1610677603829.png

 

 

 

 

@Anonymous , Try a new column like

LY =
var _type = ([Type])
var _dt = [Date]
return
sumx(filter(Table, [Type] =_type && [Date] = date(year(_dt)-1, month(_dt), day(_dt))),[TY])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
parry2k
Super User
Super User

@Anonymous Do you have a date dimension in your model? i



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Yes like below.

 

jimmyzyrzyr_0-1610676482510.png

 

 

 

parry2k
Super User
Super User

@Anonymous why you want a column for LY if the same can be achieved using Measure and which is the recommended way.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

The "column" I mean to create one to display LY total which can show up right next to the total in column in the first snip.

 

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