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
Omar1
Frequent Visitor

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,

1 ACCEPTED SOLUTION
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.

View solution in original post

4 REPLIES 4
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.

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
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.

I'll definitely give it a shot.

 

Thank you so much for the help!

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.