How to calculate average if between a certain date range?

jsabo

New Member
Joined
May 27, 2014
Messages
17
Hey guys,

Brand new to DAX and I am looking for something similar to an AverageIF...

I have a number of documents which occurred over 5 years. I would like to average how many occurred over 12 months, 24 months, etc.

So I need the DAX to be the equivalent of =AVERAGEIF the date approved falls within 12 months back from today, 24 months back from today, etc...

Any ideas? Thanks.
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
I don't know what the average portion of the formula is because you haven't described your data. However you can use calculate to filter the table so it only contains the date range you need. But what that formula looks like depends on your calendar table and the logic of a business year.

Do do you have a calendar table? If not, you should create one. Power Pivot Calendar Tables - Excelerator BI
if it passes "the rules" then you could write a formula like this.

=calculate([your avg formula],datesbetween(calendar[date),dateadd(calendar[date],-1,year),lastdate(calendar[date])))

otherwise you you could write something similar with filter
 
Upvote 0

Forum statistics

Threads
1,224,158
Messages
6,176,745
Members
452,741
Latest member
Muhammad Nasir Mahmood

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top