Guinaba
Board Regular
- Joined
- Sep 19, 2018
- Messages
- 233
- Office Version
- 2016
- Platform
- Windows
Hi guys,
I am trying to create the Index_MthYear column based on the MthYear col. below pic. So I have created a costum column with the following code, but it doesn't work. Any suggestiion?
I am trying to create the Index_MthYear column based on the MthYear col. below pic. So I have created a costum column with the following code, but it doesn't work. Any suggestiion?
Code:
if [#"Mth/Year"]=Date.AddMonths([#"Mth/Year"],0) then 1 else
if [#"Mth/Year"]=Date.AddMonths([#"Mth/Year"],1) then 2 else
if [#"Mth/Year"]=Date.AddMonths([#"Mth/Year"],2) then 3 else
if [#"Mth/Year"]=Date.AddMonths([#"Mth/Year"],3) then 4 else
if [#"Mth/Year"]=Date.AddMonths([#"Mth/Year"],4) then 5 else
if [#"Mth/Year"]=Date.AddMonths([#"Mth/Year"],5) then 6 else
if [#"Mth/Year"]=Date.AddMonths([#"Mth/Year"],6) then 7 else
if [#"Mth/Year"]=Date.AddMonths([#"Mth/Year"],7) then 8 else
if [#"Mth/Year"]=Date.AddMonths([#"Mth/Year"],8) then 9 else
if [#"Mth/Year"]=Date.AddMonths([#"Mth/Year"],9) then 10
else 99
MthYear | Index_MthYear |
1/06/2020 | 1 |
1/07/2020 | 2 |
1/08/2020 | 3 |
1/09/2020 | 4 |
1/10/2020 | 5 |
1/11/2020 | 6 |
1/12/2020 | 7 |
1/01/2021 | 8 |
1/02/2021 | 9 |