Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
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 😊
You can try something like this.
Last 12 Months=
CALCULATE (
[Total Sales],
DATESINPERIOD (
'Date'[Date],
MAX ( 'Date'[Date] ),
-12,
MONTH
)
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 🙂
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))
User | Count |
---|---|
14 | |
10 | |
7 | |
6 | |
5 |
User | Count |
---|---|
30 | |
19 | |
12 | |
7 | |
5 |