Forum Discussion
ashamsuzzoha
Advocate II
6 years agoSame Period Last N Years
Is there a function that resembles SAMEPERIODLASTYEAR but that can be expanded to more than one year back? Like the average of a monthly value for the same month the last five years? Thanks,
- 6 years ago
Hi ashamsuzzoha ,
check this out.
Regards,
Marcus
Dortmund - Germany
If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support.
ashamsuzzoha
Advocate II
6 years agoHi mwegener ,
My problem is still not solved. I tried the code you gave to try out and this is what I got:
Date Number of Leaks Number of Leaks Previous Year Average Number of Leak Previous 5 Years
1/1/2010 0:00 118 118
2/1/2010 0:00 56 56
3/1/2010 0:00 95 95
4/1/2010 0:00 123 123
5/1/2010 0:00 257 257
6/1/2010 0:00 185 185
7/1/2010 0:00 64 64
8/1/2010 0:00 37 37
9/1/2010 0:00 26 26
10/1/2010 0:00 0 0
11/1/2010 0:00 43 43
12/1/2010 0:00 14 14
1/1/2011 0:00 52 118 52
2/1/2011 0:00 102 56 102
3/1/2011 0:00 21 95 21
4/1/2011 0:00 71 123 71
5/1/2011 0:00 126 257 126
6/1/2011 0:00 143 185 143
7/1/2011 0:00 38 64 38
8/1/2011 0:00 104 37 104
9/1/2011 0:00 176 26 176
10/1/2011 0:00 286 0 286
11/1/2011 0:00 155 43 155
12/1/2011 0:00 246 14 246
1/1/2012 0:00 176 52 176
2/1/2012 0:00 194 102 194
3/1/2012 0:00 114 21 114
4/1/2012 0:00 86 71 86
5/1/2012 0:00 122 126 122
6/1/2012 0:00 104 143 104
7/1/2012 0:00 116 38 116
8/1/2012 0:00 68 104 68
9/1/2012 0:00 51 176 51
10/1/2012 0:00 232 286 232
11/1/2012 0:00 191 155 191
12/1/2012 0:00 162 246 162
1/1/2013 0:00 120 176 120
2/1/2013 0:00 60 194 60
3/1/2013 0:00 59 114 59
4/1/2013 0:00 50 86 50
5/1/2013 0:00 168 122 168
6/1/2013 0:00 241 104 241
7/1/2013 0:00 511 116 511
8/1/2013 0:00 225 68 225
9/1/2013 0:00 110 51 110
10/1/2013 0:00 111 232 111
11/1/2013 0:00 116 191 116
12/1/2013 0:00 130 162 130
1/1/2014 0:00 445 120 445
2/1/2014 0:00 335 60 335
3/1/2014 0:00 191 59 191
4/1/2014 0:00 184 50 184
5/1/2014 0:00 91 168 91
6/1/2014 0:00 27 241 27
7/1/2014 0:00 89 511 89
8/1/2014 0:00 105 225 105
9/1/2014 0:00 80 110 80
10/1/2014 0:00 267 111 267
11/1/2014 0:00 135 116 135
12/1/2014 0:00 0 130 0
1/1/2015 0:00 148 445 148
2/1/2015 0:00 125 335 125
3/1/2015 0:00 69 191 69
4/1/2015 0:00 100 184 100
5/1/2015 0:00 175 91 175
6/1/2015 0:00 183 27 183
7/1/2015 0:00 162 89 162
8/1/2015 0:00 173 105 173
9/1/2015 0:00 46 80 46
10/1/2015 0:00 178 267 178
11/1/2015 0:00 127 135 127
12/1/2015 0:00 2 0 2
1/1/2016 0:00 135 148
2/1/2016 0:00 162 125
3/1/2016 0:00 111 69
4/1/2016 0:00 64 100
5/1/2016 0:00 114 175
6/1/2016 0:00 129 183
7/1/2016 0:00 117 162
8/1/2016 0:00 102 173
9/1/2016 0:00 90 46
10/1/2016 0:00 133 178
11/1/2016 0:00 36 127
12/1/2016 0:00 28 2
1/1/2017 0:00 144 135
2/1/2017 0:00 76 162
3/1/2017 0:00 41 111
4/1/2017 0:00 41 64
5/1/2017 0:00 35 114
6/1/2017 0:00 28 129
7/1/2017 0:00 61 117
8/1/2017 0:00 43 102
9/1/2017 0:00 68 90
10/1/2017 0:00 84 133
11/1/2017 0:00 106 36
12/1/2017 0:00 1 28
1/1/2018 0:00 84 144
2/1/2018 0:00 68 76
3/1/2018 0:00 68 41
4/1/2018 0:00 50 41
5/1/2018 0:00 29 35
6/1/2018 0:00 69 28
7/1/2018 0:00 91 61
8/1/2018 0:00 126 43
9/1/2018 0:00 95 68
10/1/2018 0:00 31 84
11/1/2018 0:00 0 106
12/1/2018 0:00 0 1
1/1/2019 0:00 0 84
2/1/2019 0:00 11 68
3/1/2019 0:00 46 68
4/1/2019 0:00 40 50
5/1/2019 0:00 11 29
6/1/2019 0:00 1 69
7/1/2019 0:00 6 91
8/1/2019 0:00 8 126 v-lid-msft
Community Support
6 years agoHi ashamsuzzoha ,
After create a What-If Parameter, we can use a measure to meet your requirement:
Number of Leank Previous N Years = CALCULATE(SUM('Table'[Number of Leaks]),DATEADD(SAMEPERIODLASTYEAR('Table'[Date]),1-[Last N Year Value],YEAR))
If it doesn't meet your requirement, Please show the exact expected result based on the Tables that you have shared.
Best regards,