Annual moving average by quarter (Power Bi)
up vote
1
down vote
favorite
I want to calculate the annual average of sales by quarter in Power Bi.
I usually solve this in Excel with an Averageif between dates (last date of a quarter and same date one year earlier).
Below a sample of my data:
Date Quarter Sale
1/12/2016 2016-Q1 12.5
2/25/2016 2016-Q1 65.1
4/7/2016 2016-Q2 95.5
6/22/2016 2016-Q2 74.5
7/10/2016 2016-Q3 7.3
8/30/2016 2016-Q3 87.6
9/5/2016 2016-Q3 88.4
10/27/2016 2016-Q4 18
11/12/2016 2016-Q4 64.2
12/29/2016 2016-Q4 37.2
1/28/2017 2017-Q1 17.8
3/8/2017 2017-Q1 59.6
4/16/2017 2017-Q2 68.7
6/15/2017 2017-Q2 68.5
7/20/2017 2017-Q3 61.8
8/7/2017 2017-Q3 10.8
9/23/2017 2017-Q3 26.5
10/7/2017 2017-Q4 49.8
11/26/2017 2017-Q4 79.7
12/3/2017 2017-Q4 80.5
1/18/2018 2018-Q1 12.5
3/19/2018 2018-Q1 54.7
4/12/2018 2018-Q2 64.0
6/19/2018 2018-Q2 58.9
7/29/2018 2018-Q3 59.9
8/9/2018 2018-Q3 4.1
9/13/2018 2018-Q3 20.2
The wanted result is the table below:
Quarter1_Yr_Trailing Avg Sale
2017-Q1 52.3
2017-Q2 56.7
2017-Q3 43.3
2017-Q4 52.4
2018-Q1 51.3
2018-Q2 49.9
2018-Q3 48.4
Just to clarify, 2018-Q3 is the average of any sale that was recorded between Sept 30, 2017 and Sept 30, 2018:
10/7/2017 2017-Q4 49.8
11/26/2017 2017-Q4 79.7
12/3/2017 2017-Q4 80.5
1/18/2018 2018-Q1 12.5
3/19/2018 2018-Q1 54.7
4/12/2018 2018-Q2 64.0
6/19/2018 2018-Q2 58.9
7/29/2018 2018-Q3 59.9
8/9/2018 2018-Q3 4.1
9/13/2018 2018-Q3 20.2
Thanks for your help.
regards,
Simon
powerbi moving-average
add a comment |
up vote
1
down vote
favorite
I want to calculate the annual average of sales by quarter in Power Bi.
I usually solve this in Excel with an Averageif between dates (last date of a quarter and same date one year earlier).
Below a sample of my data:
Date Quarter Sale
1/12/2016 2016-Q1 12.5
2/25/2016 2016-Q1 65.1
4/7/2016 2016-Q2 95.5
6/22/2016 2016-Q2 74.5
7/10/2016 2016-Q3 7.3
8/30/2016 2016-Q3 87.6
9/5/2016 2016-Q3 88.4
10/27/2016 2016-Q4 18
11/12/2016 2016-Q4 64.2
12/29/2016 2016-Q4 37.2
1/28/2017 2017-Q1 17.8
3/8/2017 2017-Q1 59.6
4/16/2017 2017-Q2 68.7
6/15/2017 2017-Q2 68.5
7/20/2017 2017-Q3 61.8
8/7/2017 2017-Q3 10.8
9/23/2017 2017-Q3 26.5
10/7/2017 2017-Q4 49.8
11/26/2017 2017-Q4 79.7
12/3/2017 2017-Q4 80.5
1/18/2018 2018-Q1 12.5
3/19/2018 2018-Q1 54.7
4/12/2018 2018-Q2 64.0
6/19/2018 2018-Q2 58.9
7/29/2018 2018-Q3 59.9
8/9/2018 2018-Q3 4.1
9/13/2018 2018-Q3 20.2
The wanted result is the table below:
Quarter1_Yr_Trailing Avg Sale
2017-Q1 52.3
2017-Q2 56.7
2017-Q3 43.3
2017-Q4 52.4
2018-Q1 51.3
2018-Q2 49.9
2018-Q3 48.4
Just to clarify, 2018-Q3 is the average of any sale that was recorded between Sept 30, 2017 and Sept 30, 2018:
10/7/2017 2017-Q4 49.8
11/26/2017 2017-Q4 79.7
12/3/2017 2017-Q4 80.5
1/18/2018 2018-Q1 12.5
3/19/2018 2018-Q1 54.7
4/12/2018 2018-Q2 64.0
6/19/2018 2018-Q2 58.9
7/29/2018 2018-Q3 59.9
8/9/2018 2018-Q3 4.1
9/13/2018 2018-Q3 20.2
Thanks for your help.
regards,
Simon
powerbi moving-average
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I want to calculate the annual average of sales by quarter in Power Bi.
I usually solve this in Excel with an Averageif between dates (last date of a quarter and same date one year earlier).
Below a sample of my data:
Date Quarter Sale
1/12/2016 2016-Q1 12.5
2/25/2016 2016-Q1 65.1
4/7/2016 2016-Q2 95.5
6/22/2016 2016-Q2 74.5
7/10/2016 2016-Q3 7.3
8/30/2016 2016-Q3 87.6
9/5/2016 2016-Q3 88.4
10/27/2016 2016-Q4 18
11/12/2016 2016-Q4 64.2
12/29/2016 2016-Q4 37.2
1/28/2017 2017-Q1 17.8
3/8/2017 2017-Q1 59.6
4/16/2017 2017-Q2 68.7
6/15/2017 2017-Q2 68.5
7/20/2017 2017-Q3 61.8
8/7/2017 2017-Q3 10.8
9/23/2017 2017-Q3 26.5
10/7/2017 2017-Q4 49.8
11/26/2017 2017-Q4 79.7
12/3/2017 2017-Q4 80.5
1/18/2018 2018-Q1 12.5
3/19/2018 2018-Q1 54.7
4/12/2018 2018-Q2 64.0
6/19/2018 2018-Q2 58.9
7/29/2018 2018-Q3 59.9
8/9/2018 2018-Q3 4.1
9/13/2018 2018-Q3 20.2
The wanted result is the table below:
Quarter1_Yr_Trailing Avg Sale
2017-Q1 52.3
2017-Q2 56.7
2017-Q3 43.3
2017-Q4 52.4
2018-Q1 51.3
2018-Q2 49.9
2018-Q3 48.4
Just to clarify, 2018-Q3 is the average of any sale that was recorded between Sept 30, 2017 and Sept 30, 2018:
10/7/2017 2017-Q4 49.8
11/26/2017 2017-Q4 79.7
12/3/2017 2017-Q4 80.5
1/18/2018 2018-Q1 12.5
3/19/2018 2018-Q1 54.7
4/12/2018 2018-Q2 64.0
6/19/2018 2018-Q2 58.9
7/29/2018 2018-Q3 59.9
8/9/2018 2018-Q3 4.1
9/13/2018 2018-Q3 20.2
Thanks for your help.
regards,
Simon
powerbi moving-average
I want to calculate the annual average of sales by quarter in Power Bi.
I usually solve this in Excel with an Averageif between dates (last date of a quarter and same date one year earlier).
Below a sample of my data:
Date Quarter Sale
1/12/2016 2016-Q1 12.5
2/25/2016 2016-Q1 65.1
4/7/2016 2016-Q2 95.5
6/22/2016 2016-Q2 74.5
7/10/2016 2016-Q3 7.3
8/30/2016 2016-Q3 87.6
9/5/2016 2016-Q3 88.4
10/27/2016 2016-Q4 18
11/12/2016 2016-Q4 64.2
12/29/2016 2016-Q4 37.2
1/28/2017 2017-Q1 17.8
3/8/2017 2017-Q1 59.6
4/16/2017 2017-Q2 68.7
6/15/2017 2017-Q2 68.5
7/20/2017 2017-Q3 61.8
8/7/2017 2017-Q3 10.8
9/23/2017 2017-Q3 26.5
10/7/2017 2017-Q4 49.8
11/26/2017 2017-Q4 79.7
12/3/2017 2017-Q4 80.5
1/18/2018 2018-Q1 12.5
3/19/2018 2018-Q1 54.7
4/12/2018 2018-Q2 64.0
6/19/2018 2018-Q2 58.9
7/29/2018 2018-Q3 59.9
8/9/2018 2018-Q3 4.1
9/13/2018 2018-Q3 20.2
The wanted result is the table below:
Quarter1_Yr_Trailing Avg Sale
2017-Q1 52.3
2017-Q2 56.7
2017-Q3 43.3
2017-Q4 52.4
2018-Q1 51.3
2018-Q2 49.9
2018-Q3 48.4
Just to clarify, 2018-Q3 is the average of any sale that was recorded between Sept 30, 2017 and Sept 30, 2018:
10/7/2017 2017-Q4 49.8
11/26/2017 2017-Q4 79.7
12/3/2017 2017-Q4 80.5
1/18/2018 2018-Q1 12.5
3/19/2018 2018-Q1 54.7
4/12/2018 2018-Q2 64.0
6/19/2018 2018-Q2 58.9
7/29/2018 2018-Q3 59.9
8/9/2018 2018-Q3 4.1
9/13/2018 2018-Q3 20.2
Thanks for your help.
regards,
Simon
powerbi moving-average
powerbi moving-average
asked Nov 11 at 16:58
Simone Caschili
62
62
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53251056%2fannual-moving-average-by-quarter-power-bi%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown