Forum Discussion
Error in YTD Calc
- 8 years ago
Hi AustralPRB,
The root cause is no data of "Sundry Income" of June exists. The possible solution could be like below.
GL YTD = CALCULATE ( TOTALYTD ( [GL Actual], dDate[Date] ), ALL ( dDate[Month] ) )
Best Regards,
Dale
I had tried to add the ALL() part to the calculation formula but used dDate.Date field .
Thank you, your formula works a treat.
Regards
Peter
UPDATE ;-
Having accepted GL YTD = CALCULATE ( TOTALYTD ( [GL Actual], dDate[Date] ), ALL ( dDate[Month] ) ) as a solution I need to add a clarification to the results . As the report data will span multiple years the above formula will also capture Month data from previous years as the ALL() removes the filter. This is not what we need to do.
After looking at the problem for some time I have concluded the only way to do this is to construct you own YTD formula.
The link below is a presentation that gives all the details for the reasons for behind my statement.
https://www.sqlbi.com/tv/time-intelligence-in-microsoft-power-bi/?nu=6171
This is the formula I came up with that works. (Or seems to )
GL YTD =
VAR FirstYTD = STARTOFYEAR(dDate[Date],"30/06")
VAR LastVisibleDate = ENDOFMONTH(dDate[Date])
RETURN
CALCULATE(
GLEntries[GL Actual] ,
DATESBETWEEN ( dDate[Date] , FirstYTD ,LastVisibleDate)
)
Thanks to all .
Peter