Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi!
I am trying to, every year, dynamically sum the capital cost of the last 6 years in order to use it for calculating depreciation, i.e. something like this:
Project name Year SumOFCapexLast6yrs
Project 1 2017 10.000
Project 2 2018 384.959
etc...
I have tried the following query below, but it only sums up the cost for the same year, and I also tried PREVIOUSYEAR just to see if that worked with time intelligence, but the "SumPrevYr"is empty. For info, the DimDate-table is marked as Date Table, and there are relationships between DimDate, Data_fact and Projects
SUMMARIZECOLUMNS (
Projects[Project name],
DimDate[Year],
FILTER ( Data_fact, Data_fact[Categories Level 1] = "Capex" ),
"SumOFCapexLast6yrs", CALCULATE (
SUM ( Data_fact[Value (mill, thousands)] ),
ALL(DimDate[Date]),
DATESINPERIOD ( DimDate_test[Date], MAX ( DimDate_test[Date] ), -6, YEAR )
),
"SumPrevYr", CALCULATE (
SUM ( Data_fact[Value (mill, thousands)] ),
ALL(DimDate_test[Date]),
PREVIOUSYEAR ( DimDate_test[Date] )
)
)
Any advice for using time intelligence with summarize or other ways to achieve this?
Much appreciated!
HI @Anonymous,
I'd like to suggest you use date and all functions to manually define the filter range. (time intelligence functions reference its calendar and it will been effect by current summarize table group)
Time Intelligence "The Hard Way" (TITHW)
Regards,
Xiaoxin Sheng
I typically use Totalytd and datesytd
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(('Date'[Date]),"12/31"))
This Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD((ENDOFYEAR('Date'[Date])),"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
Last YTD complete Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
Last to last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
for rolling
Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(Sales[Sales Date]),-12,MONTH))
Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date Filer],MAX(Sales[Sales Date]),-12,MONTH))
3 month back MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-3,MONTH)))
Appreciate your Kudos.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
76 | |
76 | |
56 | |
38 | |
34 |
User | Count |
---|---|
99 | |
56 | |
51 | |
44 | |
40 |