Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Higinio
Frequent Visitor

Resultado incorrecto al aplicar una función FORMAT a una función de Fecha

Buenas tardes.

Soy nuevo en esta comunidad y agradecería me constestasen a al siguiente pregunta:

¿Porqué cuando aplico la siguiente función, me devuelve el valor 1?

Estoy intentado averiguar el nombre del mes anterios a una fecha:

Nombre_Mes = UPPER(FORMAT(MONTH('Medidas FIXING'[Hoy]= TODAY()), "mmmm"))
El resultado es ENERO 
 
Gracias.
2 ACCEPTED SOLUTIONS
Ahmedx
Super User
Super User

Name_Month = UPPER(FORMAT(EOMONTH(TODAY(),-1), "mmmm"))

View solution in original post

to return the name of the month using the FORMAT function, you need the value to be like a date. and in order to get the name of the previous month,
 you need to return the date today back, and this can be done using the EOMONTH function

View solution in original post

8 REPLIES 8
Ahmedx
Super User
Super User

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.

Ahmedx
Super User
Super User

Name_Month = UPPER(FORMAT(EOMONTH(TODAY(),-1), "mmmm"))

Thank Ahmedx. Your solution is OK.

But, I wonder why the FORMAT function doesn't work only with the TODAY() function and I have to add the EOMONTH function to it.

Do you know the reason for this behavior?

to return the name of the month using the FORMAT function, you need the value to be like a date. and in order to get the name of the previous month,
 you need to return the date today back, and this can be done using the EOMONTH function

Ahmedx
Super User
Super User

Name_Month = UPPER(FORMAT(TODAY()), "mmmm"))

 

Ahmedx
Super User
Super User

yo need wirte like this

Nombre_Mes = UPPER(FORMAT(DATE(2023,MONTH('Medidas FIXING'[Hoy]= TODAY()),1), "mmmm"))

Hello Ahmedx.

Thanks by your answer, but in my computer, the result of your version of this measure is "DECEMBER", and should be "FEBRUARY", taking in accoubt thas the mesure of Hoy is : Hoy = TODAY()

Higinio
Frequent Visitor

Also the same problem for the Mesure:

Name_Month = UPPER(FORMAT(MONTH(TODAY()), "mmmm"))

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.