Forum Discussion
Average - Year to Date
- Anonymous7 years ago
Hello Teige,
Thanks for the answer!
I'll try to build based on that calendar. But are we bringing in every month of 2019? Well, I need to get them in what you referred to as zero.
The year to date would be an average of the year, but in 2019 with the zeroes that have the average.
Best Regards,
Douglas
Hi DouglasFranco,
Could you please share the sample data and expected result to us? Based on my understanding, you want to calculate the average YTD.
In this scenario, we can create a calendar table using the following query:
calendar = ADDCOLUMNS(CALENDARAUTO(),"year",YEAR([Date]),"month",MONTH([Date]),"month/year",FORMAT([Date],"mmm")&"/"&YEAR([Date]))
Then create relationship between calendar table and data table, then we can use the following query to calculate the average YTD:
ytd2018 = TOTALYTD(AVERAGE(Data2018[KPIS]),'calendar'[Date]) ytd2019 = TOTALYTD(AVERAGE(Data2019[KPIS]),'calendar'[Date])
The result will like below:
Best Regards,
Teige
Hello Teige,
Thanks for the answer!
I'll try to build based on that calendar. But are we bringing in every month of 2019? Well, I need to get them in what you referred to as zero.
The year to date would be an average of the year, but in 2019 with the zeroes that have the average.
Best Regards,
Douglas