Forum Discussion
YTD Average Calculation
Can anyone help me with the YTD Average calculation?
I have a table visual as shown below. "A" and "B" are DAX calculations which are giving me % calculations by each month.
Now, I need to create YTD A and YTD B calculations using DAX
| Region | Dates | A | B | YTD A | YTD B |
| ABC | 1/1/2019 | 82% | 40% | ||
| ABC | 2/1/2019 | 88% | 12% | ||
| ABC | 3/1/2019 | 119% | 22% | ||
| ABC | 4/1/2019 | 67% | 35% | ||
| ABC | 5/1/2019 | 46% | 45% | ||
| ABC | 6/1/2019 | 55% | 55% | ||
| ABC | 7/1/2019 | 29% | 65% | ||
| ABC | 8/1/2019 | 34% | 90% | ||
| ABC | 9/1/2019 | 26% | 45% |
Now If I filter on Date to select 8/1/2019 then I would expect something like this
I did this in excel
YTD A =AVERAGE(C2:C9)
YTD B =AVERAGE(D2:D9)
| Region | Dates | A | B | YTD A | YTD B |
| ABC | 8/1/2019 | 34% | 90% | 65% | 46% |
Any help would be really appreciated.
Thanks,
Fareed.,
1 Reply
- amitchandakSuper User
Try Datesytd or totalytd
Year = CALCULATE(SUM(table[column]),DATESYTD('Date'[Date Filer])) Last Year = CALCULATE(SUM(table[column]),DATESYTD(dateadd('Date'[Date Filer],-12,MONTH))) Year Sales = CALCULATE(TOTALYTD(sum(Sales[Sales Amount]),('Date'[Date Filer]))) Year Sales = CALCULATE(TOTALYTD(sum(Sales[Sales Amount]),dateadd('Date'[Date Filer].-12,month)))Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.
My Recent Blog - https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601