Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

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?

 

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:

 

 

 

 

 

 

 

 

 

 

Any help will be really appreciated!

Cheers!

Aaron

  • Anonymous's avatar
    Anonymous
    7 years ago

    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.

2 Replies

  • Anonymous's avatar
    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's avatar
      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?