PERCENTAGE(VALUE, DIVIDED BY)


To calculate a percentage, it is necessary to specify both a value and what it should be divided by. The PERCENTAGE function will multiply the result of this division by 100.


PERCENTAGE may be used with datapoint properties and aggregates.


 

{|RESULT|}<table class='data'>

    <thead>

      <tr>

        <th>ID</th>

        <th>Date</th>

        <th>Score</th>

        <th>Unrounded Score</th>

      </tr>

    </thead>

    <tbody>

      {|LOOP|RESULT.DATAPOINTS(SORT=TRENDING_TIMESTAMP)}

      <tr>

        <th>{DATAPOINTS.DATAPOINT_ID}</th>

        <td>{DATAPOINTS.TRENDING_TIMESTAMP}</td>

        #the current datapoint's score

        <td>{DATAPOINTS.SCORE}</td>

        #the current datapoint's score calculated directly from points

        <td>{PERCENTAGE(DATAPOINTS.ACTUAL_POINTS, DATAPOINTS.POSSIBLE_POINTS)}</td>

      </tr>

      {/|LOOP|}

    </tbody>

  </table>

{/|RESULT|}



 {|CROSSTAB|}

  {|LOOP|CROSSTAB.LOCATION(SORT=ORDER_NUM)}

    {|SHOWIF|LOOP.ISFIRST}

    <table class='data'>

      <thead>

        <tr>

          <th>Name</th>

          {|LOOP|LOCATION.MONTH_YEAR(SORT=ORDER_NUM|DESC)}

            <th>{MONTH_YEAR.NAME} Score</th>

            <th>Percentage of Shops for Location</th>

          {/|LOOP|}

        </tr>

      </thead>

      <tbody>

    {/|SHOWIF|}

        <tr>

          <th>{LOCATION.NAME}</th>        

          {|LOOP|LOCATION.MONTH_YEAR}

            #the current location's datapoint count for this month/year

            <td>{COUNT(MONTH_YEAR)}</td>

            #the current location's datapoint count for this month/year

            #as a percentage of all shops for this location

            <td>{PERCENTAGE(COUNT(MONTH_YEAR), COUNT(MONTH_YEAR, LOCATION))}</td>

          {/|LOOP|}

        </tr>

    {|VANISHIF|LOOP.HASNEXT}

      </tbody>

    </table>

    {/|VANISHIF|}

  {/|LOOP|}

{/|CROSSTAB|}