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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Power Query Date.ToText() Format code "M" returning wrong value

In the 2.104.941.0 64-bit (april 2022) version of Power Query, the Format Code "M" returns first day of month and month name;

 Date.ToText(#date(2010, 12, 31), "M", "en-US") 

returns

December 1

Which is not the expected value 12. A workaround is of course simple; using

Number.ToText(Date.Month([Date])) 

However, it's still a bug. 

Status: Investigating

Hi @Anonymous,

 

Please try the recent version of Power BI Desktop.

Latest version of PBI Desktop: Downloads | Microsoft Power BI

Older version of PBI Desktop: Previous monthly updates to Power BI Desktop and the Power BI service - Power BI | Microsoft Docs

 

As you can see, if test in 2.105.1143.0 64-bit (May 2022), it works well.

vcazhengmsft_0-1656924579624.png

 

Best Regards,

Community Support Team _ Caiyun

Comments
v-cazheng-msft
Community Support
Status changed to: Investigating

Hi @Anonymous,

 

Please try the recent version of Power BI Desktop.

Latest version of PBI Desktop: Downloads | Microsoft Power BI

Older version of PBI Desktop: Previous monthly updates to Power BI Desktop and the Power BI service - Power BI | Microsoft Docs

 

As you can see, if test in 2.105.1143.0 64-bit (May 2022), it works well.

vcazhengmsft_0-1656924579624.png

 

Best Regards,

Community Support Team _ Caiyun

Anonymous
Not applicable

Sorry, I see that I had lost a digit, however, the issue is still present in latest version of Power BI; 2.106.883.0 64-bit (june 2022).

 

According to the documentation, 

 Date.ToText(#date(2010, 12, 31), "M", "en-US") 

should return 12 (as a text string).

However, as you point out, @v-cazheng-msft , it returns

December 31