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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
MichaelG1117
Helper I
Helper I

Creating a "BY WEEK" Date Table labeled like "Mar 13" With Weeks Being Consecutive

Hi Everyone, 

 

I created this Date Table: 

Capturea.PNG

It gave me this: 

 

Captureb.PNG

 The weeks recycle per year, meaning Total Order Amounts of 'Weeknum 4' will be 2013 and 2014 added together which will mess up my chart.  Is there any way to seperate them by creating a date table by consective weeks without going back to "Week 1" at the start of a New Year? 

 

ALSO: This is what my column chart looks like: 

Capturec.PNG

 As you can see it's by week. 

 

I need to make it so the X-Axis is labeled by "MMM-YYYY" with lapses in between like this:  

Captured.PNG

 

I created a column for dates according to "MMM-YYYY" format but when I put it in it comes out all wonky, not even putting the dates in order: 

Capturee.PNG
Again, thank you so much for any help --- it would greatly, greatly appreciated. 
 
Thanks,
 
Michael G. 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @MichaelG1117 ,

 

Based on the information you provided, regarding your previous question, you can follow these steps:

1.Add a column.

 

 

Consecutive Week Number =

WEEKNUM ( [Date], 2 )

    + 52

        * ( YEAR ( [Date] ) - YEAR ( MINX ( ALL ( 'Date Table' ), [Date] ) ) )

 

 

Final output:

vyifanwmsft_0-1703141418490.png

 

For the X-axis labels, you can follow these steps:

 

  1. Create a new column in the date table and change its type.
Month Year = FORMAT([Date], "MMM-YYYYY")

vyifanwmsft_1-1703141470134.png

 

 

vyifanwmsft_2-1703141470134.png

 

Final output:

vyifanwmsft_0-1703141562116.png

 

How to Get Your Question Answered Quickly - Microsoft Fabric Community

If it does not help, please provide more details with your desired out put and pbix file without privacy information.

 

Best Regards,

Yifan Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @MichaelG1117 ,

 

Based on the information you provided, regarding your previous question, you can follow these steps:

1.Add a column.

 

 

Consecutive Week Number =

WEEKNUM ( [Date], 2 )

    + 52

        * ( YEAR ( [Date] ) - YEAR ( MINX ( ALL ( 'Date Table' ), [Date] ) ) )

 

 

Final output:

vyifanwmsft_0-1703141418490.png

 

For the X-axis labels, you can follow these steps:

 

  1. Create a new column in the date table and change its type.
Month Year = FORMAT([Date], "MMM-YYYYY")

vyifanwmsft_1-1703141470134.png

 

 

vyifanwmsft_2-1703141470134.png

 

Final output:

vyifanwmsft_0-1703141562116.png

 

How to Get Your Question Answered Quickly - Microsoft Fabric Community

If it does not help, please provide more details with your desired out put and pbix file without privacy information.

 

Best Regards,

Yifan Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hi @Anonymous , 

 

Is there a way to write that 'Consecutive Week Number' column directly into a table? I am not allowed to make calculated columns for this. 

 

I'm assuming that after making the initial table it would be something like: 

 
return
ADDCOLUMNS(
    _table,    
    "Total Order Amount",

 

..But I'm unsure about the correct syntax regarding your code above to create it in directly into the table. 

 

 

AS FOR THE COLUMN CHART: 

I created the Month Year Column, changed the Data Type to "Date" and the Format to "YYYY-MM" but mine does not look like yours.

 

Each column in the chart also has to be "BY WEEK" (Weeknum), not by month, so the Week numbers are still on there also as I'm putting both "WEEKNUM" and "MONTH YEAR" into the X-Values. 

 

Capturen.PNG

 Even when I don't add "WeekNum" on the X-axis in there it still doesn't have the "Mar 2013" format: 

 

Capturel.PNG

 This is what I need it to look like: 

Captured.PNG

I'm assuming they created a Date Column that incorporates both WeekNumber AND Date? 

 

I did create two date columns that incorporate Week Number and Year: 

   
"Week Number & Year", "W" & WEEKNUM([Date]) & " " & YEAR([Date]),
    "WeekYearNumber", YEAR ( [Date] ) & 100 + WEEKNUM ( [Date] ),

 

...But when I try to change the Data Type to DATE it does not allow me to do so, I'm assuming because it's mixing integers and varchar. 

 

I guess I'm now wondering if there is a way to create a DATE COLUMN that incorporates the "Mar 2013" Format along with the WeekEnding Number to go with it. 

 

Again, thanks --- 

 

Hi! were you able to solve it? I have the same issue. It shows the week numbers, month and year on the x axis. Any advice you can provide?  I am not allowed to make calculated columns for this either

Anonymous
Not applicable

Hi @MichaelG1117 ,

 

According to a way to write that 'Consecutive Week Number' column directly into a table, you can add this Dax below:

 

Date Table =

VAR _Table=

ADDCOLUMNS(

    CALENDAR(DATE(2013,1,24),DATE(2014,2,31)),

    "Consecutive Week Number",WEEKNUM([Date],2)

    + 52

        * ( YEAR ( [Date] ) - YEAR (DATE(2013,1,24) ) ),

    "Week Number & Year","W" & WEEKNUM([Date]) & " " & YEAR([Date]),

    "WeekYearNumber",YEAR([Date]) & 100 + WEEKNUM([Date]),

    "MonthShortYear",FORMAT([Date],"mmm-YYYY")

)



RETURN

_Table

 

 

Since the data on the x-axis in Clustered column chart is in alphabetical or numerical order, you should transform "Mar 2013" into "2013-3" to achieve your goal:

 

vyifanwmsft_0-1703831767740.png

 

 

Final output:

 

vyifanwmsft_1-1703831767744.png

 

How to Get Your Question Answered Quickly - Microsoft Fabric Community

If it does not help, please provide more details with your desired out put and pbix file without privacy information.

 

Best Regards,

Yifan Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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