Forum Discussion
Bar chart starts with wrong month
I have a simple bar chart displaying counts by month. It is filtered by relative dates "is in the next 1 year," but it starts with January instead of October (today). Any suggestions?
- Anonymous6 years ago
The easiest way to solve is, in your Date table, create a column "Month Year" or something like that that has the Month and the Year. Then use that field in your bar chart.
You'll also need to create a MonthYearSort column that will get the Month Year column sorted properly (use the Sort By Column feature).
Here's the DAX:
MonthYear = FORMAT('Date'[Date], "MMM yyyy")MonthYearSort = FORMAT('Date'[Date], "yyyyMM")
Eric
4 Replies
- venal
Memorable Member
Anonymous
Can you please share us the PBIX file with the sample data with the current and expected results.
- amitchandak
Super User
First, use the month year and check. Is sorting working?
Also is this column created by you or generated by power bi hierarchy?
- AnonymousNot applicable
I made the date table. It consists of a column of unique dates representing the underlying data table and then columns for the corresponding day, month and year.
I am using the Date column in the bar chart. I've tried using it as both the date hierarchy and just the date and various combinations of the month and month and year in the date hierarchy. If I set it as date instead of date hierarchy, I can get close. The bar chart now starts at the right time, but it splits the months into two bars. Maybe I can fix that with some formatting help.
- AnonymousNot applicable
The easiest way to solve is, in your Date table, create a column "Month Year" or something like that that has the Month and the Year. Then use that field in your bar chart.
You'll also need to create a MonthYearSort column that will get the Month Year column sorted properly (use the Sort By Column feature).
Here's the DAX:
MonthYear = FORMAT('Date'[Date], "MMM yyyy")MonthYearSort = FORMAT('Date'[Date], "yyyyMM")
Eric