Forum Discussion
Calculate YTD using Short Month Name
- 6 years ago
- 6 years ago
thanks Ashish_Mathur danextian amitchandak stretcharm for all your help.
I was able to solve this using Ashish_Mathur solution.
I also found a similar solution here which also worked - https://community.powerbi.com/t5/Desktop/TotalYTD-to-Last-Month/m-p/692437
Correct Formula = VAR pre = CALCULATE ( MAX ( 'CalendarAuto'[Date] ), FILTER ( 'CalendarAuto', DATEDIFF ( 'CalendarAuto'[Date], TODAY (), MONTH ) = 1 ) ) RETURN CALCULATE( SUM(Sheet1[EAC]), FILTER( Sheet1, YEAR(Sheet1[Custom Date]) = YEAR(pre) && Sheet1[Custom Date] <= pre ) )The idea of using a separate Calendar table is a good one and one that I will use in the future I'm sure. Thanks danextian for the tip.
Thanks again.
Yoshi
thanks Ashish_Mathur danextian amitchandak stretcharm for all your help.
I was able to solve this using Ashish_Mathur solution.
I also found a similar solution here which also worked - https://community.powerbi.com/t5/Desktop/TotalYTD-to-Last-Month/m-p/692437
Correct Formula =
VAR pre =
CALCULATE (
MAX ( 'CalendarAuto'[Date] ),
FILTER ( 'CalendarAuto', DATEDIFF ( 'CalendarAuto'[Date], TODAY (), MONTH ) = 1 )
)
RETURN
CALCULATE(
SUM(Sheet1[EAC]),
FILTER(
Sheet1,
YEAR(Sheet1[Custom Date]) = YEAR(pre)
&& Sheet1[Custom Date] <= pre
)
)
The idea of using a separate Calendar table is a good one and one that I will use in the future I'm sure. Thanks danextian for the tip.
Thanks again.
Yoshi
- Ashish_Mathur6 years ago
Super User
You are welcome.