Forum Discussion
Stacked column chart with dynamic legend
- 1 year ago
Hi Justas4478 ,
Thank you for the update and for trying the suggested option. The custom visual may not fully match Excel’s dynamic legend alignment because Power BI’s visuals, both native and custom, don’t replicate this feature exactly. The best way to achieve similar behaviour is by reshaping your data model using Unpivot Columns and then creating the stacked column chart as previously described. This setup allows the legend to update dynamically with filters, which addresses your main requirement. Although the result may not look exactly like Excel, it is currently the most reliable and supported method in Power BI.
If you need a closer match, you could explore other visuals in AppSource, but the unpivot and stacked column chart remains the most consistent and flexible solution.
Thank you,Tejaswi.
2 solutions for such a visual
solution 1 ; ( easy approach )
use the custom visual :
if the number of values in the legend is fixed , then you can create a measure per each group .
solution 2 : ( more complex dax approach )
Bas on youtube did create a visual using native power bi visual and dax, to create a line chart with table below it.
i honestly cant remember the name of the video, but it was on the channel : how to powerbi ( by bas )
for me, i would go with the first solution. easier .
hope this helps .