cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
vat2do
Helper I
Helper I

Week No with Month and year no

Hope you have great day,

 

I need support to get the out put in new column as "Week 1 January 22" from the date table created using calender auto showing one year dates in power query.

 

Thanks in advance

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@vat2do 

just like what @Rudy_D  said, you can't create the column in PQ if you use dax to create a table.

pls try this

 

Column = "Week " & WEEKNUM('Table'[Date],2) &" "& format('Table'[Date],"mmmm")&" "& right(year('Table'[Date]),2)
 
or 
 
Column 2 = "Week " & ROUNDDOWN(('Table'[Date]-min('Table'[Date]))/7,0)+1 &" "& format('Table'[Date],"mmmm")&" "& right(year('Table'[Date]),2)
 
1.PNG




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

8 REPLIES 8
ryan_mayu
Super User
Super User

@vat2do 

just like what @Rudy_D  said, you can't create the column in PQ if you use dax to create a table.

pls try this

 

Column = "Week " & WEEKNUM('Table'[Date],2) &" "& format('Table'[Date],"mmmm")&" "& right(year('Table'[Date]),2)
 
or 
 
Column 2 = "Week " & ROUNDDOWN(('Table'[Date]-min('Table'[Date]))/7,0)+1 &" "& format('Table'[Date],"mmmm")&" "& right(year('Table'[Date]),2)
 
1.PNG




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




vat2do
Helper I
Helper I

i created simple date table with column name "Date" using "CALENDARAUTO()" expression

If you used Calendarauto(), I guess you have created the table in Dax.

So you cannot add the column requested using power query. But I can show you how to do it in Dax.

Yes i am using DAX, appreciated to have a solution thanks

You can use this formula :

 

Newcolumn = CONCATENATE("Week ",CONCATENATE(WEEKNUM('Table'[Date]), CONCATENATE(" ", CONCATENATE(FORMAT('Table'[Date], "MMM"), CONCATENATE(" ", YEAR('Table'[Date]))))))
 
Rudy_D_0-1660810148987.png

 

hi,

your solution is useful to me, another quick question, how i can repeat the week numbers when a month name changes like week 1, week2, week3 and week 4 for January but i need to repeat starting from week 1 to week 4 in february and so on

@vat2do 

you can try this

Column 2 = "Week " & ROUNDDOWN(('Table'[Date]-min('Table'[Date]))/7,0)+1 &" "format('Table'[Date],"mmmm")&" "right(year('Table'[Date]),2)

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Rudy_D
Helper I
Helper I

Hi,

 

Could you please describe the date table from which you want to create the new column ?

 

Thanks

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

Thank you 2022 Review

2022 Monthly Feature Releases

We had a great 2022 with a ton of feature releases to help you drive a data culture.