Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi Community,
I try to create a line chart with Total Sales by Year-Month column and an additionally constant line giving the maximum of Total Sales (Global Max).
I have this simple data model and date table:
I get the line chart below which is almost perfect but has a wrong (alphabetic) sort order in x axis:
Correct Max Line, wrong sort order in x axis.
If I change the sort order of my Year-Month column in my date table and sorting it by YearMonthKey, the Global Max line in my chart gets broken and I see this:
correct x axis sorting - wrong max line
My question is: what's wrong here?
The definiton for my Global Max measure is:
Global Max =
MAXX(
ALL('Date'[Year-Month]),
[Total Sales]
)
Thanks for your help!
Solved! Go to Solution.
@amitchandak Thank you for your response!
Your solution helps!
I found also another solution. If I sort Year-Month column by YearMonthKey it also helps to include the sort by-column in my measure like here:
Global Max =
MAXX(
ALL('Date'[Year-Month], 'Date'[YearMonthKey]),
[Total Sales]
)
@amitchandak Thank you for your response!
Your solution helps!
I found also another solution. If I sort Year-Month column by YearMonthKey it also helps to include the sort by-column in my measure like here:
Global Max =
MAXX(
ALL('Date'[Year-Month], 'Date'[YearMonthKey]),
[Total Sales]
)
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 66 | |
| 48 | |
| 43 | |
| 26 | |
| 19 |
| User | Count |
|---|---|
| 198 | |
| 126 | |
| 102 | |
| 67 | |
| 50 |