GithubHelp home page GithubHelp logo

global19-atlassian-net / pbi-htmldisplay Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cpcodes/pbi-htmldisplay

0.0 2.0 0.0 37 KB

A simple visual for Power BI that displays HTML handed to it. Perfect for custom formatting output using a measure.

TypeScript 95.74% CSS 4.26%

pbi-htmldisplay's Introduction

PBI-HTMLDisplay

A simple visual for Power BI that displays HTML handed to it. Perfect for custom formatting output using a measure. Like my banner visual, this was also borne from the need to display text in a larger font than the built-in Card visual allows (40 pt). Due to the problems I was having with the formatting pane in the other visual, this provided a better solution without relying on any formatting pane options.

Usage

There are no special rules for using the visual. It has no settings and only accepts one Measure. Using a custom measure, you can use HTML formatting and strin concatenation (the &) to display a static HTML string, or embed 1 or more fields/summarizations of live data.

Examples

Assuming you have a Date table with a column that contains the Month and Year like "November 2018" called [MonthNameYear] and the daily sales for your company's widgets in the Sales table in the column called [Count], and the two tables are linked by date, you can create the following measure to show the sum of sales for the most recent month (use a relative date filter to filter to the last 1 Calendar Months):

Monthly Sales Card = "
<div style='text-align: center'>
  <div style='font-size: 12px'>Total Sales for</div>
  <div style='font-size: 24px'>" & LASTNONBLANK('Date'[MonthNameYear], 'Date'[MonthNameYear]) & "</div>
  <div style='font-size: 48px; color: Red'>" & FORMAT(SUM('Sales'[Count]), "#,0,") & "K</div>
</div>" 

That will produce the following output (Note that github does not render this correctly, so you will have to imagine that it looks like it's supposed to, or view the Markdown file in another viewer):

Total Sales for

November 2018

280K

With some fancier DAX code, you can probably do tables and maybe even javascript, but I haven't tried that at this point.

Known Bugs and TODOs

None!

pbi-htmldisplay's People

Contributors

cpcodes avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.