Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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

 

RegionDatesABYTD AYTD B
ABC1/1/201982%40%  
ABC2/1/201988%12%  
ABC3/1/2019119%22%  
ABC4/1/201967%35%  
ABC5/1/201946%45%  
ABC6/1/201955%55%  
ABC7/1/201929%65%  
ABC8/1/201934%90%  
ABC9/1/201926%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)

 

RegionDatesABYTD AYTD B
ABC8/1/201934%90%65%46%

 

Any help would be really appreciated.

 

Thanks,

Fareed.,

1 REPLY 1
amitchandak
Super User
Super 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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors