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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
peterlyngvig
Regular Visitor

Last twelve months

Hi,

 

In the table below, I have presented some monthly cost data - each data represents the sum of the various costs items for each month. The input data is a spreadsheet with credit card transactions with a date column and cost column representing the date and cost for each transaction. I would like to make another version of this table, which shows last twelve months data instead of the monthly data. As an example, the column October, should show the sum of costs for the twelve months starting November the previous year and ending October this year. The column September should show the sum of the costs for the period starting October previous year and ending September this year. And so on. Can anyone help with this please? Thanks 😊

 

peterlyngvig_0-1668265823702.png

 

3 REPLIES 3
AnkitKukreja
Super User
Super User

Hi @peterlyngvig 

 

You can try something like this.

Last 12 Months=
CALCULATE (
   [Total Sales],
   DATESINPERIOD (
      'Date'[Date],
      MAX ( 'Date'[Date] ),
      -12,             
      MONTH                 
    )

 

For Power BI trainings or support dm or reach out to me on LinkedIn.
If my response has successfully addressed your question or concern, I kindly request that you mark this post as resolved. Additionally, if you found my assistance helpful, a thumbs-up would be greatly appreciated.

Thanks,
Ankit Kukreja
www.linkedin.com/in/ankit-kukreja1904

Thanks Ankit.

 

I tried your solution, but I am getting the error message "A single value for column 'Cost' in table 'Sheet1' cannot be determined". See below. What is wrong here? Your help is much appreciated 🙂

 

peterlyngvig_0-1668282497326.png

 

Anonymous
Not applicable

Hi

 

If you have a date table it is easy.

12 month =
var datemax=selectedvalue(Date[Month])

return

calculate(sum(cost),removefilters(date[Month)),DATESINPERIOD('Date'[Date],datemax,-11,Month))

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.