Forum Discussion

SEMattis's avatar
SEMattis
Advocate III
2 years ago

[DAX] Format function returning wrong month and date?

Hi,

 

So I have a problem with the formatting function which could be error 45 (I.e. yours truly) or something really interesting is happening in Power BI. When using the following syntax:


VAR Prev_M = MONTH((TODAY())) -
 
It returns 1. However when setting the variable in the FORMAT function and converting the date to a month name the measure returns "December" (See images below).

Need some help 😄

13 Replies

  • _AAndrade's avatar
    _AAndrade
    Resident Rockstar

    The problem is in you dax formula. You put 

    And you must put -1 inside parantesis. like this:

     



     

  • _AAndrade's avatar
    _AAndrade
    Resident Rockstar

    Tell me what you want to show on the visual and I will give you the correct dax function.

    • SEMattis's avatar
      SEMattis
      Advocate III

      So I want the FORMAT function to return "December" rather than January

  • Anonymous's avatar
    Anonymous
    Not applicable

    I'am having the same problem. It is terrible.

     

    • _AAndrade's avatar
      _AAndrade
      Resident Rockstar

      Open a new ticket with your problem and I will take a look

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi SEMattis 

    How about  FORMAT(TODAY(),"MMM") ? Perhaps MOTH function is messing up something .
    Thanks !

    • SEMattis's avatar
      SEMattis
      Advocate III

      Well this would not work since I am dependent on months in the past to solve my problem. Good idea though.