Forum Discussion
TotalYTD function returning error
- Anonymous4 years ago
Hi akkitek ,
You can try to change the formula to the following form:
ODC Expense YTD = CALCULATE(SUM('FACT_Fin_Data_by_Mo'[ODC Expense]), FILTER(ALL('Calendar'),'Calendar'[Date]<=TODAY()&&'Calendar'[Date]>=DATE(YEAR(TODAY()),1,1)))Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi,
Assuming the Month column has proper date entries, create a Calendar Table and build a relationship from the Month column to the Date column of the Calendar Table. To your visual, drag the Date from the Calendar Table. Write this measure:
ODC_expenses = SUM(FACT_Fin_Data_by_Mo[ODC Expense])
YTD ODC expenses = calculate([ODC_expenses],datesytd(calendar[date],"31/12"))
Hope this helps.
- akkitek4 years agoHelper III
Hey Ashish_Mathur ,
Thanks for your reply. I created a calendar table with proper date entries using the calendar function and built the relationship. I created your suggested measures, The error is gone but it returns 0 which is not very useful. Am I missing something here?Looking foward to hearing from you:)
- Ashish_Mathur4 years agoSuper User
Hi,
Share the link from where i can download your PBI file.
- akkitek4 years agoHelper III
Hey Ashish_Mathur ,
Here's the link to the file:
https://drive.google.com/file/d/1hYDaBCJQNGfp1XGeNzAxeVAbGiNlaBMX/view?usp=sharing
When i use the following measures, I get 0:ODC_expenses = SUM(FACT_Fin_Data_by_Mo[ODC Expense])
YTD ODC expenses = calculate([ODC_expenses],datesytd(calendar[date],"31/12"))
and When i use this measure, I get the error:
ODC Expense YTD = TOTALYTD(SUM(FACT_Fin_Data_by_Mo[ODC Expense]),FACT_Fin_Data_by_Mo[Month])