Forum Discussion
TotalYTD weird behaviour
Hello all,
I ran into a weird behaviour of TOTALYTD
.not adding to YTD from September even though there are values in the following months
I used the following measure for the YTD column:
YTD Forecast = TOTALYTD([Forecast];Period[DateToUseInMeasures].[Date])
Thank you again, AlB
My initial pbix did't reflect the original as PLAN does have values for every month.
So I needed some sort of IF function.
I did a search on SUMIF equivalents in DAX and found this post here which was helpful
https://community.powerbi.com/t5/Desktop/SUMIF-Equivalent-in-DAX/td-p/230727
I then changed the Forecast Function to this
Forecast = SUMX(Tabelle;IF(Tabelle[ACT] = BLANK();CALCULATE(SUM(Tabelle[PL]));CALCULATE(SUM(Tabelle[ACT]))))
This solved the issue and gave both correct Totals and correct YTD.
So thank you again AlB and Thanks TomMartens
7 Replies
- AlBCommunity Champion
Hi cbhh76
I would try to avoid the Auto date (.[Date]) feature and work with my own calendar table instead. The auto date time is prone to causing (apparently) weird behavior.
Another thing that I find weird is that the total for the measure is the same as the total for the TOTALYTD, so perhaps there's something wrong with that to start with?
Can you share the pbix? or at least show the code for the measure and the tables involved?
Please mark the question solved when done and consider giving kudos if posts are helpful.
Cheers

- cbhh76Regular Visitor
Thank you for your quick response.
When I try to use anything else, other than .[Date] like for example .[Year] or .[Month] I get an error. Not sure how to use a different calendar table here, as the one used in this measure is used in all other measure throughout the report.
Unfortunately I am not able to share the pbix.
The Forecast measure is
Forecast = IF([Produktion IST]>0;[Produktion IST];[Produktion Plan])
- cbhh76Regular Visitor
Hi again,
Thank you, AlB
I have recreated the behaviour in a seperate pbix.
The problem doesn't seem to be in the YTD function but rather in the way I created my Forecast measure.
However, this behaviour and the way the totals are calculated seem rather buggy.
I have uploaded the pbix and appreciate any help.
Regards
Chri