Skip to content

Connect Power BI

This guide is for the person who builds reports in Power BI. It takes about 15 minutes. You need Power BI Desktop, a Salma Console login, and the Data API add-on switched on for your Organisation.

Salma gives Power BI one table per form, one per repeat group, and one per list. Each table has one plain value per column and the same columns on every row, so Power BI can load it without extra steps.

In Power BI Desktop: Home, Get data, Blank query, Advanced Editor, and paste this, with your data address:

let
SalmaBase = "https://YOUR-SALMA-ADDRESS/data",
Tables = Json.Document(Web.Contents(SalmaBase, [RelativePath = "v1/tables"]))
in
Tables

When Power BI asks how to connect, choose Basic: user name key, password your API key, at the level of the data address. The reply lists every table you can read:

Table name One row per
form_<form key> submission
form_<form key>__<repeat key> answer set in a repeat group, with submission_id to join back to the form table
lookup_<list key> record in a list, for example a farmer
  1. Home, Get data, Blank query. Then Advanced Editor.
  2. Paste the query from power-bi-salma-table.pq (download it, open it in a text editor and copy it).
  3. Change SalmaBase to your data address and TableName to a name from Part 1. Click Done.
  4. When Power BI asks how to connect, choose Basic. User name key, password your API key. Set the level to the data address, not the full table address, so one sign-in covers every table.
  5. Name the query after the form, then Close and Apply.

Repeat for each table. Power BI loads text and numbers as plain values; set each column’s type (Whole number, Decimal, Date) in Power Query once.

Column Meaning
submission_id The submission. Joins a repeat table to its form table.
review_status received (not reviewed yet), hasIssues, approved or rejected. Rejected submissions are left out.
salma_officer_id, salma_officer_name The field officer who sent it.
received_at When Salma received it.
salma_released_at When it became available to reports.
salma_form_version The form version the officer used.
<question> The answer. For a multiple choice question, the chosen values separated by spaces.
<question>_label The labels of the chosen options.
<question>_latitude, _longitude, _altitude, _accuracy A GPS point, ready for a map visual.
<question>_mode For a list question: how the officer picked the record.
salma_row_seq, salma_modified_at When the row last changed in Salma.

Form columns never disappear. If a later form version drops a question, its column stays and new rows leave it empty. A new question adds a column. A table with no rows yet (or none left, after the last one is deleted or rejected) comes back with no columns, so load a table after its first visit. List tables are different: a list field’s column disappears if that field is blank on every record, so a report step that names it can fail on refresh.

  1. Publish from Power BI Desktop to your workspace.
  2. In the Power BI service, open the semantic model’s settings. Under Data source credentials, sign in with Basic again (key and your API key).
  3. Under Refresh, turn on scheduled refresh. Power BI allows up to eight refreshes a day on shared capacity. Source: https://learn.microsoft.com/en-us/power-bi/connect-data/refresh-data

Each refresh reads every row again, so deleted and corrected submissions are always right. No gateway is needed: Salma is on the internet.

What you see What to do
401 or a sign-in prompt again The key was revoked or mistyped. Make a new key and edit the credentials.
403 feature disabled The Data API add-on is off for your Organisation. Ask Salma support.
404 The table name is wrong, or the form is confidential. Check Part 1.
429 Too many requests at once. Refresh fewer tables at the same time, or wait a minute.
“This dataset includes a dynamic data source” The query was changed to build the address by hand. Use the query from this guide unchanged apart from the two values.