Business Rules & Decision Tables — Builder Reference

This page covers the RASON JSON model structure for the Decision Tables example. For an overview of the end-to-end workflows, see Business Rules & Decision Tables.

How the Model Flows

A RASON model is declarative JSON. Each section has a specific role:

Section What it does
datasources Imports inputs from Power BI queries or Excel cell ranges — one datasource per input column.
data Binds each datasource to a model variable (age, medHistory).
decisionTables Defines the rules that map inputs to outputs.
formulas Calls the table with bound inputs and exposes the result via finalValue.

 

Section 1 — datasources

Choose either Power BI or Excel as your data source — not both. Everything downstream works the same either way.

Power BI

Each datasource uses type: "PowerBI" and a DAX SELECTCOLUMNS query to pull one column from the report.

"InputData_age": {
  "type": "PowerBI",
  "connection": "pbix=DecisionTableExample",
  "selection": "EVALUATE SELECTCOLUMNS('InputData', \"Age\", 'InputData'[Age])",
  "colIndex": "InputData_index",
  "direction": "import"
}
// InputData_medhistory follows the same shape
Note: Models importing from a local .pbix file may only be solved using Solver Mode: Local.

Excel

The same pattern applies: type becomes excel and selection is a cell reference instead of a DAX query.

"datasources": {
  "exceldata_age": {
    "type": "excel",
    "connection": "DecisionTableExample.xlsx",
    "selection": "Sheet1!C7",
    "direction": "import",
    "header": false
  },
  "exceldata_medhistory": {
    "type": "excel",
    "connection": "DecisionTableExample.xlsx",
    "selection": "Sheet1!D7",
    "direction": "import",
    "header": false
  }
}

Section 2 — data

Bind each datasource to a model variable. To switch from Power BI to Excel, just point the bindings at the Excel datasource names — the decision table and formula don't change.

"age":        { "binding": "InputData_age" },
"medHistory": { "binding": "InputData_medhistory" }

Section 3 — decisionTables

Ranges use interval syntax: [25..60] is inclusive on both ends. A "-" means any value. Hit policy "U" (Unique) means rules must not overlap — exactly one rule fires per input. See Hit Policies for the full reference.

"PolicyUnique": {
  "inputs":  ["age", "medHistory"],
  "outputs": ["riskRating", "rule"],
  "rules": [
    [">60",      "good", "medium", "r1"],
    [">60",      "bad",  "high",   "r2"],
    ["[25..60]", "-",    "medium", "r3"],
    ["<25",      "good", "low",    "r4"],
    ["<25",      "bad",  "medium", "r5"]
  ],
  "hitPolicy": "U"
}

Section 4 — formulas

The decision table is called like a function. The two leading empty arguments are placeholders left at their defaults. "finalValue": [] tells the engine to return this result when the model is solved.

"res": {
  "formula": "PolicyUnique(,,age, medHistory)",
  "finalValue": []
}

Full RASON Code — Power BI Edition

{
  "modelName": "DTDatasourceExample",
  "modelType": "calculation",

  "datasources": {
    "InputData_age": {
      "type": "PowerBI",
      "connection": "pbix=DecisionTableExample",
      "selection": "EVALUATE SELECTCOLUMNS('InputData', \"Age\", 'InputData'[Age])",
      "colIndex": "InputData_index",
      "direction": "import"
    },
    "InputData_medhistory": {
      "type": "PowerBI",
      "connection": "pbix=DecisionTableExample",
      "selection": "EVALUATE SELECTCOLUMNS('InputData', \"MedicalHistory\", 'InputData'[MedicalHistory])",
      "colIndex": "InputData_index",
      "direction": "import"
    }
  },

  "data": {
    "age":        { "binding": "InputData_age" },
    "medHistory": { "binding": "InputData_medhistory" }
  },

  "decisionTables": {
    "PolicyUnique": {
      "inputs":  ["age", "medHistory"],
      "outputs": ["riskRating", "rule"],
      "rules": [
        [">60",      "good", "medium", "r1"],
        [">60",      "bad",  "high",   "r2"],
        ["[25..60]", "-",    "medium", "r3"],
        ["<25",      "good", "low",    "r4"],
        ["<25",      "bad",  "medium", "r5"]
      ],
      "hitPolicy": "U"
    }
  },

  "formulas": {
    "res": {
      "formula": "PolicyUnique(,,age, medHistory)",
      "finalValue": []
    }
  }
}