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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
msalas
Regular Visitor

DateTime Format formula

Hello,

Can someone help me with this formula? What I want done is that anything on my "Week No." column that has 1-4, in the new column "Months", it comes up as "Jan", 5-8 is "Feb", and so on. But I'm getting an error on the dash after 2022. It works fine in Alteryx but not sure if the formula is different in Power BI.

 

DateTimeFormat(DateTimeAdd(DateTimeAdd('2022-01-01',-ToNumber(DateTimeFormat('2022-01-01','%w')),'Days'),7*[Week No.],'Days'),'%b')

 

msalas_0-1668629740237.png

 

1 ACCEPTED SOLUTION
artemus
Microsoft Employee
Microsoft Employee

I think the formula would be:

Date.ToText(#date(2022, 1, 1) + [Week No.] * #duration(7, 0, 0, 0), [Format = "MMM", Culture = "en-us"])

 

View solution in original post

3 REPLIES 3
artemus
Microsoft Employee
Microsoft Employee

I think the formula would be:

Date.ToText(#date(2022, 1, 1) + [Week No.] * #duration(7, 0, 0, 0), [Format = "MMM", Culture = "en-us"])

 

That worked, thank you. 

serpiva64
Solution Sage
Solution Sage

Hi,

i think you have to use " instead of '.

 

Helpful resources

Announcements
December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.