cancel
Showing results for
Did you mean:
Helper I

## Average of 12 months plus last month of previous year

Hey guys,

I want to calculate an average of monthly values of GAV for a year. But instead of starting at January, start at December of the previous year and include all months of year (and for ongoing year all months to date) + december last year. It was so simple in excel, and I can't figure out a solution on PBI.
Here is a simple example of what I am trying to do:

Any ideas how to set up the time inteligence for this?

2 ACCEPTED SOLUTIONS
Solution Sage

Do you have Year column in your table, or you use a Date table? I am using the same to show you one way

``````Ave =
VAR CurY=MAX(factTable[Year])
RETURN
AVERAGEX(FILTER(ALL('factTable'),factTable[Data]>=DATE(CurY-1,12,1)&&factTable[Data]<=DATE(CurY,12,31)),[GAV])``````

Solution Sage

Yes, your case is different from the simple Excel sample, so modified a little bit

``````Average GAV =
VAR CurY=MAX(Dates[Year])
VAR T1 = CALCULATETABLE(ADDCOLUMNS(ALL(Dates[EndOfMonth]),"TEST",[GAV]),ALL(Dates[Year]))
RETURN
AVERAGEX(FILTER(T1,[EndOfMonth]>=DATE(CurY-1,12,1)&&[EndOfMonth]<=DATE(CurY,12,31)),[TEST])``````

4 REPLIES 4
Solution Sage

Do you have Year column in your table, or you use a Date table? I am using the same to show you one way

``````Ave =
VAR CurY=MAX(factTable[Year])
RETURN
AVERAGEX(FILTER(ALL('factTable'),factTable[Data]>=DATE(CurY-1,12,1)&&factTable[Data]<=DATE(CurY,12,31)),[GAV])``````

Helper I

Hey, thank you a lot it does seem to work with the excel data, but my PBI model has a few extra details and for some reason it does not include the december of last year it seams. I am attaching an example file:
https://www.dropbox.com/s/a006u6lay2mnsvl/Example7.pbix?dl=0
In this case the expected value for 2021 would be 27176766,83.

Solution Sage

Yes, your case is different from the simple Excel sample, so modified a little bit

``````Average GAV =
VAR CurY=MAX(Dates[Year])
VAR T1 = CALCULATETABLE(ADDCOLUMNS(ALL(Dates[EndOfMonth]),"TEST",[GAV]),ALL(Dates[Year]))
RETURN
AVERAGEX(FILTER(T1,[EndOfMonth]>=DATE(CurY-1,12,1)&&[EndOfMonth]<=DATE(CurY,12,31)),[TEST])``````

Helper I

Worked like a charm, thank you 🙂

Announcements

#### Manage your user group events

Check out the News & Announcements to learn more.

#### 2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

#### Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

#### Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors
Top Kudoed Authors