Forum Discussion
Adjusting X-Axis Max with Visual Calculation for Stacked Bar Chart
- 1 year ago
Thanks for the detailed reply and all the suggestions, unfortunately:
- When used as visual calculations, they give the same result as above: selecting the total value * 1.1 not the value of the longest bar.
- When using ALLSELECTED() in a "normal" measure I get an error message:
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)
- 1 year ago
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.
Thanks for the detailed reply and all the suggestions, unfortunately:
- When used as visual calculations, they give the same result as above: selecting the total value * 1.1 not the value of the longest bar.
- When using ALLSELECTED() in a "normal" measure I get an error message:
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 ...