Different Formats in same KPI

Dear fellow app builders,

we have a KPI that has a column “kpi_value” with two rows, i.e. two KPI values. One of them is a percentage value the other one is not. Furthermore, the one that is not a percentage is a count and thus can never have decimals. Is it possible to have a different format for one of the rows in the data?

Code:

{
  "id": "kpi_invoice_receipts",
  "type": "kpi",
  "source": "open_invoices_kpi",
  "sourceOptions": {
    "sql": "SELECT * FROM( SELECT CASE WHEN c.val2 = 0 THEN 0 ELSE (c.val1 / c.val2) * 100 END as kpi_value, \"kpi_name1\" as kpi_name, \"%\" as unit, 2 as index FROM ( ( SELECT SUM(i.open) as val2, 1 as index FROM inputTable i ) as a INNER JOIN ( SELECT COUNT(*) as val1, 1 as index FROM inputTable i WHERE i.status_of_ocr = 0 AND i.open = 1 ) as b ON a.index = b.index ) as c UNION SELECT COUNT(*) as kpi_value, \"kpi_name2\" as kpi_name, \" \" as unit, 1 as index FROM inputTable i WHERE i.open = 1 AND i.status_of_ocr = 0 ) as d ORDER BY d.index"
  },
  "config": {
    "color": "#becd32",
    "kpiName": {
      "column": "kpi_name"
    },
    "value": {
      "column": "kpi_value"
    },
    "unit": {
      "column": "unit"
    },
    "layout": {
      "orientation": "vertical"
    }
  },
  "syncSets": [
    {
      "syncSetId": "syncSet_openInvoices",
      "publishFilters": false,
      "applyFilters": true
    }
  ]
}

Thanks in advance :slight_smile:

Hi Melchior,
Once I want to cover such a scenario I format everything exactly like I want to have it as text. Then I can gurantee the display format in such cases. Maybe this is also an option for you.