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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Sorting week numbers by year in bar chart

Hi all,

 

I'm trying to display revenue by week number in a bar chart, however, as my dataset contains multiple years, the revenue totals are summing by week number across all years. Rather than doing this, is there a way to present the graph so that it shows each week individually by year?

 

week numbers.jpg

I'd like the chart to show 1-52 for 2018 and then 1-9 for the data in 2019.

 

I'm also trying to reduce the "noise" in the axis - concatenating the year and week number will leave me with an axis value for each bar which looks messy!

 

Final output should look something like this:

 

excel week numbers.jpg

 

 

 

 

 

 

 

 

 

Any help will be really appreciated!

Cheers!

Aaron

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Create a new column in your Data table called Year.Week or something. Use the Concatenate, Right, Mid, and Left functions as needed to get an output that looks like "201905" that represents week 5 of 2019.

 

Then on the chart, sort ascending by this new column. If you provide a screenshot of your data table or tell me the format I can help further.

 

The formula that I have used in the past looks something like...

 

Year.Week = Concatenate( Right( 'Table'[Date], 4), Mid('Table'[Date], 4, 2))

 

 

Edit: Whoops, just saw your sentence about not wanting to concatenate.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Create a new column in your Data table called Year.Week or something. Use the Concatenate, Right, Mid, and Left functions as needed to get an output that looks like "201905" that represents week 5 of 2019.

 

Then on the chart, sort ascending by this new column. If you provide a screenshot of your data table or tell me the format I can help further.

 

The formula that I have used in the past looks something like...

 

Year.Week = Concatenate( Right( 'Table'[Date], 4), Mid('Table'[Date], 4, 2))

 

 

Edit: Whoops, just saw your sentence about not wanting to concatenate.

Anonymous
Not applicable

I'm hoping someone can help - I've used this solution to sort the week numbers correctly in my bar chart with the latest week being 202102 but how do I display them in a more user friendly format?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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