Forum Discussion

Yolo_pbi's avatar
Yolo_pbi
Frequent Visitor
2 years ago
Solved

Format function changing the current month to previous month

Hey guys,

I am using today function to get the current month, i.e. Month(Today()) which gives me output 2 as for February, but when I use format() to get the full name it changes to January - any idea what could be reason behind?
Here's the code: 

Reporting month =
Var Current_Month = MONTH(TODAY())
RETURN
FORMAT(Current_Month,"MMMM")
  • Hi Yolo_pbi 
    This happens because the current month is not a date datatype, it is just a number. so you always will have it as a January.
    Modify your formula to 

    Current_Month =
    FORMAT(today(),"mmm")

    pbix is attached

    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

2 Replies

  • PijushRoy's avatar
    PijushRoy
    Community Champion

    Hi Yolo_pbi 

    Please create a measure

     

     

    Current Month = FORMAT(TODAY(),"MMMM")

     

     

     


    Let me know if that works for you


    If your requirement is solved, please mark THIS ANSWER as SOLUTION ✔️ and help other users find the solution quickly. Please hit the Thumbs Up 👍 button if this comment helps you.

    Thanks
    Pijush
    Linkedin

  • Hi Yolo_pbi 
    This happens because the current month is not a date datatype, it is just a number. so you always will have it as a January.
    Modify your formula to 

    Current_Month =
    FORMAT(today(),"mmm")

    pbix is attached

    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly