I’ve been able to use the new kpi API to connect Kobo securely to Power BI and read submission results. I thought this might be of interest to others or could be improved on, so I’m sharing my steps below:
I managed to get the data into Power BI so I was initially very happy about that. However, I have a provlem with the JSON file that is extracted from the Kobo database… FYI, I am doing a household survey, and was only able to extract one record for each of the 126 households, but, when I expanded the field that said group, which contianed data about the children, I only got one record per household. This could be my inexpereince using JSON files on Power BI or is it an issue with the extract.?
Hi David,
Your data is there, however you need to just expand your data appropriately. Just to ensure that you are getting a wider support, have a look at the forum here to see if any users has cracked this.
I hope it is ok to add a question to this posting.
In the Help Center article, “Pulling your data into Excel Power Query”, it states
Before transitioning over the Excel, make sure that there is a) at least 1 record stored in your data table in KoboToolbox and b) under the Project’s settings, set it to “share data publicly”.
If we use the UNHCR INFORMATION MANGEMENT KoBo Toolbox methodology of connecting KoBo data to Power PI (https://im.unhcr.org/kobosupport/) listed above, do we need to make the data available publicly?
I am attempting to set up a scheduled refresh with Power BI online.
Note:
I have a Power BI pro licence.
I can refresh kobotoolbox in my Power Bi Desktop software
I was able to refresh from Power Bi serivces back in Feb using your very helpful instructions but i am struggling now.
Could you please you can tell me what settings you put in the data source credentials?
Was the Privacy level setting for this data source None or Private.
I click the skip test conection and it dones not work
At present, I have added “&refresh=1” to the end of the URL that i got to share on a public website as I want to refresh every 1 minute just to test this out. Nothing seems to change however.
Hi @mikehoneymf,
I’m interested in doing this, however I’m not sure how to get the API token. When I go into REST Services, it requires an “endpoint url” - do you know what I should enter there if I just want to import into PowerBI?
At the moment kindly please follow the support article Using the API to get the API token. In the next release of the KoBoToolbox, you would get the API token directly from under your ACCOUNT SETTINGS without having to follow all the steps as outlined in the support article.
Hi @mikehoneymf,
Thanks to @Kal_Lam’s pointing me in the right direction to get the API token, I was able to follow the steps you shared and get PowerBI connected up to project data where I hadn’t made the data public - woohoo!
However - I basically have got the JSON data in the PowerQuery showing as a LIST of RECORDS. And if I just say “to Table” in the PowerQuery, it gives me an error:
Expression.Error: We cannot convert a value of type Record to type Text.
Details:
Value=[Record]
Type=[Type]
I’m not sure if you had this same error, as I’m pretty sure it’s based on the fact that there are a few columns in the KoboToolbox data that come in as “LISTS” or “RECORDS” - and my feeling is that Power BI isn’t converting them, or doesn’t know quite how to.
Do either you or @iker.montes have any advice on what to do once the JSON data is in the Power Query, but how to then convert the records to a table?
Thanks @iker.montes - I’m the same, my knowledge of JSON is very limited right now.
I was wondering if instead of JSON there was a link that could pull in csv format, like you did in your PowerBI connector for shared data.
@mikehoneymf or @Kal_Lam:
In the above examples made by @mikehoneymf, you said to use this url for the API connection into Power Bi: https://[kpi-url]/assets/[form-uid]/submissions/?format=json
This worked for me, but now I’m getting stuck actually turning the JSON data into a usable table. I think csv format would work better for me. Is there a url that would link csv data instead?
(I tried just replacing /?format=json with /?format=csv - but that didn’t work for me)
Just out of curiosity I tried this method and gives me good results.
The query in the advance editor was:
let
Query1 = let
Source = Json.Document(Web.Contents(“https://kobo.humanitarianresponse.info/assets/FORM_ID/submissions/?format=json”, [Headers=[Authorization=“TOKEN”]])),
issues = Source[issues]
in
Source,
#“Converted to Table” = Table.FromList(Query1, Splitter.SplitByNothing(), null, null, ExtraValues.Error)
in
#“Converted to Table”
No problem with the JSON conversion to table. Just 2 clicks.
Althouh it would be great to have the tada as labels, So It can read it without further manipulations.
If you, @janna, want send me teh credentians in a private post and I can have a look!
Regards