Forum Discussion

M_SBS_6's avatar
M_SBS_6
Icon for Helper V rankHelper V
3 years ago
Solved

Month Offset rolling 12 months

Hi, 

I have a table that I need a new column to show the months offset on a rolling 12 months. Below is how I would expect to see the table as we're in May

MonthMonth_offset
Jan9
Feb10
Mar11
Apr12
May1
Jun2
Jul3
Aug4
Sep5
Oct6
Nov7
Dec8


When we move into the June, I would expect the month_offset to shift to to this

 

MonthMonth_offset
Jan8
Feb9
Mar10
Apr11
May12
Jun1
Jul2
Aug3
Sep4
Oct5
Nov6
Dec7

 

Any idea how I can create this Month_offset please?

  • Hi M_SBS_6 

     

    If your current Month column is of Text data type and it only has month short names, you can add a new column with below DAX to have month offset values. 

    Month_offset = 
    var vdate = DATEVALUE([Month]&" 1 "&YEAR(TODAY()))
    var curMonth = MONTH(TODAY())
    var vMonth = MONTH(vdate)
    return
    IF(vMonth<curMonth,vMonth-curMonth+13,vMonth-curMonth+1)

     

    Best Regards,
    Community Support Team _ Jing
    If this post helps, please Accept it as Solution to help other members find it.

1 Reply

  • v-jingzhang's avatar
    v-jingzhang
    Icon for Community Support rankCommunity Support

    Hi M_SBS_6 

     

    If your current Month column is of Text data type and it only has month short names, you can add a new column with below DAX to have month offset values. 

    Month_offset = 
    var vdate = DATEVALUE([Month]&" 1 "&YEAR(TODAY()))
    var curMonth = MONTH(TODAY())
    var vMonth = MONTH(vdate)
    return
    IF(vMonth<curMonth,vMonth-curMonth+13,vMonth-curMonth+1)

     

    Best Regards,
    Community Support Team _ Jing
    If this post helps, please Accept it as Solution to help other members find it.