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
I've recently learned from a youtube video that it is possible to use visual calculation to increase the range of an axis dynamically to e.g. have 1.1 x the value of the longest. Now I've tried this on a stacked bar chart, but the MAXX function uses the total of all rows for the axis (red line), not the longest individual row (pink line).
It would be great to be able to extend the x-Axis as it is very close to the legend:
Solved! Go to Solution.
Thanks for the detailed reply and all the suggestions, unfortunately:
What did work is this measure (not visual calculation) - (cyan rectangle in screenshot below)
max_by_type =1.1 * MAXX([dim_column],[measure])
Using the same syntax as visual calculation
vc = 1.1* MAXX(ROWS,[measure])
is not working (red rectangle in screenshot below)
Hi @eneri ,
Your DAX measure using MAXX(VALUES(dim_column), [measure]) works correctly because it calculates the maximum total per bar via row context, whereas the visual calculation MAXX(ROWS, [measure]) fails for axis scaling since it evaluates across individual segments rather than entire rows, leading to incorrect results like the total sum instead of the maximum row.
Use this DAX measure to dynamically scale your axis based on the longest individual bar:
max_by_type =1.1 * MAXX([dim_column],[measure])
Replace dim_column with the dimension that defines each bar (example: Category, Type, etc.).
Use this measure (max_by_type) as a reference to x axis, set the x-axis maximum manually or use it in layout logic.
Please provide sampple data, so we can reproduce your requirement.
Hope this helps.
Best Regards,
Chaithra E.
Hi @eneri ,
We would like to confirm if you've successfully resolved this issue or if you need further help. If you still have any questions or need more support, please feel free to let us know. We are more than happy to continue to help you.
Thank you for your patience and look forward to hearing from you.
Best Regards,
Chaithra E.
Hi @eneri ,
We would like to confirm if you've successfully resolved this issue or if you need further help. If you still have any questions or need more support, please feel free to let us know. We are more than happy to continue to help you.
Thank you for your patience and look forward to hearing from you.
Best Regards,
Chaithra E.
Hi @eneri ,
We’d like to follow up regarding the recent concern. Kindly confirm whether the issue has been resolved, or if further assistance is still required. We are available to support you and are committed to helping you reach a resolution.
Thank you for your patience and look forward to hearing from you.
Best Regards,
Chaithra E.
Hi @eneri ,
Your DAX measure using MAXX(VALUES(dim_column), [measure]) works correctly because it calculates the maximum total per bar via row context, whereas the visual calculation MAXX(ROWS, [measure]) fails for axis scaling since it evaluates across individual segments rather than entire rows, leading to incorrect results like the total sum instead of the maximum row.
Use this DAX measure to dynamically scale your axis based on the longest individual bar:
max_by_type =1.1 * MAXX([dim_column],[measure])
Replace dim_column with the dimension that defines each bar (example: Category, Type, etc.).
Use this measure (max_by_type) as a reference to x axis, set the x-axis maximum manually or use it in layout logic.
Please provide sampple data, so we can reproduce your requirement.
Hope this helps.
Best Regards,
Chaithra E.
Hi @eneri ,
I see what's happening with your visual calculation. The issue is that MAXX is looking at the total values across all rows rather than finding the maximum value within individual stacked bars.
Here's how to fix this:
Solution 1: Use MAXX with the right context Instead of your current formula, try this visual calculation:
MaxBarLength = MAXX(ALLSELECTED(), [YourMeasure])
This should evaluate each row individually rather than summing everything up.
Solution 2: Create a measure first, then reference it Create a base measure that calculates your stacked values:
StackedValue = SUM([YourColumn])
Then use this in your visual calculation:
AxisMax = 1.1 * MAXX(ALLSELECTED(), [StackedValue])
Solution 3: Use SUMMARIZE for row-level calculations
MaxIndividualBar =
1.1 * MAXX(
SUMMARIZE(
ALLSELECTED(),
[dim1],
"RowTotal", [YourMeasure]
),
[RowTotal]
)The key is making sure your calculation evaluates at the row level, not across the entire dataset. Visual calculations sometimes need explicit context to work properly with stacked visuals.
Try Solution 1 first as it's the simplest approach. You can find more details about visual calculations in the Power BI visual calculations documentation.
If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.
This response was assisted by AI for translation and formatting purposes.
Thanks for the detailed reply and all the suggestions, unfortunately:
What did work is this measure (not visual calculation) - (cyan rectangle in screenshot below)
max_by_type =1.1 * MAXX([dim_column],[measure])
Using the same syntax as visual calculation
vc = 1.1* MAXX(ROWS,[measure])
is not working (red rectangle in screenshot below)
It's not really a "solution" as it's not using a visual calculation as requested in the initial post. But MS Community Support seems to be eager to mark any topic as solved ...
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 41 | |
| 39 | |
| 37 | |
| 29 | |
| 24 |
| User | Count |
|---|---|
| 119 | |
| 100 | |
| 72 | |
| 69 | |
| 65 |