Forum Discussion
Time Intelligence calculations based on Fiscal Calendar
Hello Experts,
I tried to search for fiscal time intelligence calculations to learn but did find any resources. Appreciate it if you could please help me with this?
I have a fiscal calendar table and fact table. The fiscal Year starts in February. I want to create measures based on fiscal dates like Fiscal YTD, Fiscal MTD, Fiscal QTD, Fiscal Previous Year, Fiscal Previous Month, Fiscal Previous Quarter, and Last 7 fiscal days etc.
Attached file.
File link- pbix
Thank you
8 Replies
- lbendlin
Super User
You can use the built-in time intelligence functions for nearly all of this. Some functions allow you to specify the end of the fiscal year.
The only exception is the Fiscal Quarter stuff - that you have to do manually, but you can use EDATE() shifting to great effect.
- Sid_SandyRegular Visitor
Hi lbendlin , I tried to use DATEADD to calculate Previous Fiscal Year as below but not time intelligence function like DATEADD, PREVIOUSYEAR etc
PY Fiscal =var curyear=MAX(FY_dates[FISCAL_YEAR No])var preyear=curyear-1returnCALCULATE([Total Sales],FILTER(ALL(FY_dates),FY_dates[FISCAL_YEAR No]=preyear))Could you pls show your examples for these time intelligence calculations? I'd appreciate your help.Thank you so much!RegardsSid- amitchandak
Super User
Sid_Sandy , For Fiscal Year and month Datesytd and datesmtd should work.
Get required columns and qtr rank of feb calendar from here
Creating Financial Calendar - From Any Month
https://community.powerbi.com/t5/Community-Blog/Creating-Financial-Calendar-Decoding-Date-and-Calendar-1-5-Power/ba-p/1187441example
MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth('Date'[Date]))..columns
Qtr Start Date = DATEADD(STARTOFYEAR('Date'[Date],"1/31"),QUOTIENT(DATEDIFF('Date'[Start Of Year], 'Date'[Date],MONTH),3)*3,MONTH)
Qtr Month No = DATEDIFF('Date'[Qtr Start Date],'Date'[Date],MONTH)+1
Qtr Rank = RANKX(all('Date'),'Date'[Qtr Start date],,ASC,Dense)measures
This Qtr = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Qtr Rank]=max('Date'[Qtr Rank])))
Last Qtr = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Qtr Rank]=max('Date'[Qtr Rank])-1))year
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
Month behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Month))
Quarter behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-3,Month))
Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA
Power BI — Qtr on Qtr with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-qtd-questions-time-intelligence-2-5-d842063da839
https://www.youtube.com/watch?v=8-TlVx7P0A0
Power BI — Month on Month with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA
Power BI — Week on Week and WTD
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-Last-Week/ba-p/1051123
https://www.youtube.com/watch?v=pnAesWxYgJ8
- lbendlin
Super User
You would do things like
TOTALYTD(something something,"1/31")
to indicate the shift in the fiscal calendar vs the regular one.
This works for Month and Year time intelligence. For Quarter intelligence you can use DATEADD(dates,1,MONTH) or EDATE(1) depending on if you are shifting an entire table column or a single value.
Your 445 logic is independent of that, you will have to maintain that in your dates table manually. Don't waste your time with the M code, do it in the data source.