Forum Discussion
Year To Date Values When Single Month Slicer Selected
- 6 years ago
ashleylinkewich , Please a calendar/Table table marked as date table
example
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")) This year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31")) Last year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))Power BI — YTD
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38aTo get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-YTD-LYTD-Week-Over-Week/m-p/1051626#M184
Appreciate your Kudos.
Hi Greg_Deckler , thanks for your help!
I would be happy to use a date table, however whenever I map it to my budget table, I get this error:
Which seems like a circular reference error, or otherwise? I've never seen it before.
I added and tried to modify your code slightly to find the maximum fiscal month number to only calculate for this financial year:
Budget YTD =
VAR __Date = MAX('**IBRCS FY21 Budget'[FiscalMonthNo])
VAR __Table =
ADDCOLUMNS(
FILTER(ALL('**IBRCS FY21 Budget'),[FiscalMonthNo]<__Date),
"__BudgetCalc",[BudgetCalc]
)
RETURN
SUMX(__Table,[__BudgetCalc])
When I add that to the table however, it seems like its summarising everything, regardless of the KPI group: Is there a way to separate them out or am I going about this the wrong way? Perhaps if I can get the date table to work that will provide the most straightforward solution...
Thanks again for your help!
ashleylinkewich - FTR, I was not necessarily advocating the T"I" route. Sample data and expected output are generally the shortest path to victory.
- ashleylinkewich6 years ago
Advocate II
Greg_Deckler - totally, it seems like a bit of a nightmare. Love your blog though! Really clear.
Thanks again! I've managed to sort it by clearing up the problem with my date table
- Greg_Deckler6 years ago
Community Champion
ashleylinkewich Great!! 🙂