Average until last completed month

Good morning everyone,

I have a pivot table that shows the page impressions by placement and country for each month in a year.

The calculation that I created is: avg({page_impressions},[{ad_placement},{ad_country}])

My question is: how can I modify that calculation to only consider the last completed month?

So, for this current year, it would calculate the average until the end of August.

Thanks!

Paula

Hi @proma90,

You can add an ifelse function inside your avg like this:

avg(
	ifelse({impression_date} <= {completion_date}, {page_impressions}, null), 
	[{ad_placement},{ad_country}]
)

I’m not sure if this is the exact condition you want to add but this should give you an idea.