Top N ranking with bars HTML
Top N list of a category with proportional bars and values, in a single measure.
How to use it in Power BI
- Install the HTML Content visual (by Daniel Marsh-Patrick) from AppSource: under “Get more visuals”, search for “HTML Content”.
- In Power BI Desktop, create a New measure and paste the DAX code from the generator.
- Replace the bracketed names with the measures and columns from your model, if you have not done so in the form.
- Add the HTML Content visual to the page and drag the measure into the Values field.
FAQ
Does it work in the Power BI Service?
Yes. The HTML Content visual renders the measure in Desktop and in published reports.
Why do width numbers use "en-US"?
CSS and SVG require a dot as the decimal separator. Forcing the culture in FORMAT prevents models in other locales from emitting “12,5%” and breaking the layout.
Does the measure respect filters and slicers?
Yes. It is a regular DAX measure: whatever filters the source measures filters the generated HTML.
Can I restyle it later?
Yes. The HTML is plain text inside the measure; edit colors, sizes and fonts in the DAX or generate it again here.