Forum Discussion

Omar1's avatar
Omar1
Frequent Visitor
8 years ago
Solved

Bar graph on a week-by-week basis

Hello,

 

I hope someone can help me. I've tried and read the other posts and watched videos, but was unable to accomplish it.

 

I have a bunch of dates and was able to get the week number for each date by creating a new column using the WEEKNUM. \

 

Now, I'd like to sum the total for each week and show it in a bar graph where the y-axis shows the total while the x-axis show week-over-week based on what-ever time period I specify.

 

Thanks,

  • Anonymous's avatar
    Anonymous
    8 years ago

    The best method I can suggest is to firstly create a date table, there is some code you'll find on google to help with that.

     

    Create a YearWeek column which is simply the Year and Week concatinated into a single unique value (do some fancy formatting to make it look displayable).  Set that as your axis.  Set its Sort By Column to your Date column, that should give you the correct order.  In the Visual filter, bring the date column in and use "Relative Filtering" set to last 24 months.

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Based on what you have described, have you tried putting the Axis as your week number and your values as the field you wish to have summed (You may need to choose Sum in the drop arrow).

     

    If you do the above, you'll also need to filter the years, as it would sum all Week 1s from all years into a single bar.  So create a slicer of a given year to avoid this problem.

    • Omar1's avatar
      Omar1
      Frequent Visitor

      Thank you for the quick response!

       

      I did do that and it certainly works, but I was hoping to see the last 24 months on a weekly basis, but then it would sum up weekly 20 for the last 24 months and so on.

       

      Sorry for not being more clear before.

       

      Can you think of a way to show weekly totals over the past 24 months?

       

      Is there a way to possible turn the week number by year into the date of the week start? I assume then I can sum up all the numbers with the same week start date and show that over time.

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        The best method I can suggest is to firstly create a date table, there is some code you'll find on google to help with that.

         

        Create a YearWeek column which is simply the Year and Week concatinated into a single unique value (do some fancy formatting to make it look displayable).  Set that as your axis.  Set its Sort By Column to your Date column, that should give you the correct order.  In the Visual filter, bring the date column in and use "Relative Filtering" set to last 24 months.