Progress Bars

Bullet

_Linear Gauge Normalised = 
VAR MAXPlan = [Profit Plan]
VAR MAXActual = [Profit Actual]
VAR MAXTarget = [Profit Target]
VAR AXISRANGE = MAXX(
    {
        MAXPlan,
        MAXActual,
        MAXTarget
    },
    [Value]
)
VAR TRACKWIDTH = MAXPlan/AXISRANGE*100
VAR PERCENTAGEFILL = MAXActual/AXISRANGE*100
VAR PERCENTAGETARGET = MAXTarget/AXISRANGE*100
RETURN
IF(HASONEVALUE(financials[Country]),
"data:image/svg+xml;utf8," & "
    <svg width='100' height='20' viewBox='-2 -2 102 22' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' overflow='visible'>
        <rect id='track' x='0' y='2' width='"&TRACKWIDTH&"' height='18' fill='lightsteelblue'/>
        <rect id='fill' x='0' y='6' width="& "'"& PERCENTAGEFILL &"'"&" height='10' fill='navy'></rect>
        <rect id='marker' x="&"'"&PERCENTAGETARGET&"'"&" y='1' width='2' height='20' fill='red'></rect>
    </svg>
", BLANK())

Progress Bar

_Linear Progress = 
VAR Actual = [Gross Sales]
VAR Target = [Gross Sales Target]
VAR PERCENTAGEFILL = Actual/Target*100
RETURN
IF(HASONEVALUE(financials[Country]),
"data:image/svg+xml;utf8," & 
"<svg width='100' height='20' viewBox='-2 -2 102 22' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' display= 'block'  overflow='visible'>
  <defs>
    <linearGradient id='linear' x1='0%' y1='0%' x2='"&100+(100-PERCENTAGEFILL)&"%' y2='0%'>
      <stop offset='0%'   stop-color='navy'/>
      <stop offset='100%' stop-color='cyan'/>
    </linearGradient>
  </defs>
<rect id='track' x='0' y='3' rx='0' ry='0' width='100' height='15' fill='#D0D0D0' />
<rect id='fill' x='0' y='3' rx='0' ry='0' width="& "'"& PERCENTAGEFILL &"'"&" height='15' fill='url(#linear)'></rect>
</svg>"
, BLANK())

1 comment

  1. Hi, thanks for this visual! I tried to add a second target line in the bullet chart by simply duplicating every line that contains “PERCENTAGETARGET”, which worked. But when there is no data, the graphic shows this extra target line. Would you know why?

Leave a comment

Your email address will not be published. Required fields are marked *