Forum Discussion
Problem with months not in order on line chart
- 6 years ago
Ok. without something to work with it is difficult to assist. But let me try one more thing.
Download this PBIX file. It has some random data I put together for 2020. Notice how the chart is not sorted by month properly. I'm not sure how it is sorted. It isn't alphapbetical or by date. Do the following:
- Click on the Month Name field in the Date table.
- Click on the Column Tools menu (this is the new ribbon)
- Click Sort By Column
- Pick "Month" which is an integer from 1-12 that perfectly corresponds to Jan-Dec.
- In your chart, click the elipses and ensure it is being sorted by Month Name, not Sales.
Ensuring the chart is sorting correctly.
It should now be sorted by the Month Name, which in turn is sorted by the numerical month number.
See if walking through that process helps. I don't know what else to do if I cannot have access to your PBIX file to more closely examine the issue.
jhern90 the month field in your date table should not be a Date type. A month number is an integer.
The Sort By Column solution works. This isn't a workaround. this is how Power BI and the data model in Excel's Power Pivot are designed. Can you please post some sample data in a PBIX file and share via OneDrive so we can see exactly what your issue is? I am thinking this is a 5 minute fix but we've been guessing what your data model looks like for two weeks. I'd really like to help you move this project forward. If it is confidiential data you don't want to post, but you feel comfortable sharing with me (or someone else in this thread) please share via PM.
edhans, unfortunately I cannot share the file since it contains client data. The month column is a number, I was referring to the original date column. I went back to my data source and update the dates on some rows so I wouldn't have any duplicate rows to see if that would fix it but that didn't seem to fix the problem.
- edhans6 years ago
Community Champion
Ok. without something to work with it is difficult to assist. But let me try one more thing.
Download this PBIX file. It has some random data I put together for 2020. Notice how the chart is not sorted by month properly. I'm not sure how it is sorted. It isn't alphapbetical or by date. Do the following:
- Click on the Month Name field in the Date table.
- Click on the Column Tools menu (this is the new ribbon)
- Click Sort By Column
- Pick "Month" which is an integer from 1-12 that perfectly corresponds to Jan-Dec.
- In your chart, click the elipses and ensure it is being sorted by Month Name, not Sales.
Ensuring the chart is sorting correctly.
It should now be sorted by the Month Name, which in turn is sorted by the numerical month number.
See if walking through that process helps. I don't know what else to do if I cannot have access to your PBIX file to more closely examine the issue.
- jhern906 years agoFrequent Visitor
edhans, thanks for that. I was able to test your file and was able to play around with it. I don't have a date table which might be onbe of the reasons why I cannot sort my data. I was trying to sort the data based on the date column on the same table. I will try out creating a date table and mapping it to my data table to see if I can make that work. Thanks
- edhans6 years ago
Community Champion
Great. You do not have to have a date table, but it makes your life easier if you do, in many ways, and without one, Time Intelligence functions simply do not work.
That M code in my file is my standard Date table that I copy and paste in to all new files. I actually use this method to make it 100% dynamic so it is always covering all data in my file.
- PBICW2 years agoRegular Visitor
Works like a charm. Thank you so much!!!