Forum Discussion
How to Sort Bar Chart by Month Number from Live Query but Not Show On Chart
- 1 year ago
I re-created your problem and was able to get the X axis to sort correctly per your specifications.
Make sure the visual is sorted according to the Month and Year column as well.
See the attached .pbix file, perhaps you can reverse engineer it to see where you went wrong.
///Mediocre Power BI advice, but it's free///
- 1 year ago
You are correct that there is no need to add it to the tool tip.
Did you download the .pbix file I created for you? It has everything done, all you need to do is compare and find the difference between your file and mine.
Check everything to make sure you're doing it the same way. Check the data types of the columns, make sure Month_And_Year is sorted by year_month, and that year_month is formatted as a whole number, check the connection between the date table and the fact table in your semantic model, etc.
Create a Month and Year column like this:
then use Month_And_Year in your visual on the X axis.
Best practice is to do this in a Date Dimension table that has an active relationship to other tables on the date field.
///Mediocre Power BI Advice, but it's free///
I created a date table and made a relationship between by transaction table and the date table using the respective date fields. I clicked in the Data pane of power bi desktop the Year Month field to bring up the "Column tools" tab in the ribbon, and proceeded to sort on the Year Month field. The visualization refreshed but it didn't sort. If I click the ellipsis on the bar chart itself, it seems to always want to sort on one of the X-axis fields, and I can't uncheck it.