At the recent Blackbaud K-12 Conference, I spent some time with Grahm Getty who did a presentation on using PowerBI with the Blackbaud ON products. The ability to visualize your data is really powerful and can be used to find insights and problems in your data. Grahm and I spent some time figuring out how to use the Blackbaud API to get the data in real-time into PowerBI so that it is always up-to-date and doesn’t require exporting and using CSV files. We were able to get this to work with the desktop version of PowerBI, but it doesn’t seem to work with the web version. I haven’t given up on that, but for now I thought I would share a tutorial on how to get it to work with the desktop version of PowerBI. What follows is a tutorial that assume you know nothing of the Blackbaud API nor Microsoft PowerBI.
This tutorial requires:
- You have the Blackbaud API enabled. There is an annual fee for this, so you need to contact your account manager if you do not already have it. It comes bundled with ODBC access, so if you have that, then you have API access.
- A machine running some modern version of Windows. It can be emulated in VMware or Parallels if your a Mac user. PowerBI requires Windows.
Setup within the Blackbaud “ON” products
- Create a new user within the “ON” products to use to make API calls. It is best practice to use a separate account to make API calls.
- As a Platform Manager, go to Core>Users/Access>Profile
- Click “Add New User”
- Fill out the Last Name, First Name, Username and pick and confirm a temporary password. I used “PowerBI” as the First Name, “API” as the Last Name and “powerbi-api” as the username.
- In the screen that follows, edit the user.
- Under “System Information” for the user we just created, click “Role Membership”.
- Click “Edit”.
- Enable “Web Services API Manager” and click on “Save & Exit”.
- Sign Out of the ON products and login with your newly created account.
- When you login, you will be forced to change your password. Change it.
- Sign Out of the ON products and login to your normal account.
- Go to lists (Faculty>My Day>Schedule & Performance>Lists>View All).
- At this point, we need to create the list that we want to use in PowerBI. For the purposes of this demo, we will use one based on a list template.
- Click on List Templates.
- Under “Template Category” pick “Constituent Information”
- Find “Students by Current Grade” and click on “View/Copy”
- Under name, give it a name (I used “PowerBI student information”)
- Let’s add Ethnicity.
- Click on the “Select Objects” tab.
- Under “Constituent Information”, click “User Citizenship/Residency”
- Click on the “Display Fields” tab.
- At the bottom of the screen, click on “Select Fields…”
- Expand “User Base” by clicking on the +
- Expand “User Citizenship/Residency”
- Check the checkbox next to “Ethnicity” and “Citizenship” and then click the “Select” button.
- Click the “Preview” button on the bottom right of the screen to preview the list.
- Click “Save & Exit” on the top right.
- Next we need to get the list ID number so that we can use it in an API call. This ID number is somewhat hidden.
- Control-click on the “Run” link next to the list we just created.
- Select “Copy Link” from the pop-up menu that appears.
- Go to the text editor of your choice and paste the link. (note: if you only see “Run” when you paste you’ll need to paste it as unformatted text (on a Mac: command-option-shift-v).
- after “slid=” there is a number (in the example 49748). This is the list ID. Make a note of your list ID.
- Next we have to grant the API account we setup earlier with access to the list we want to use.
- Click on the “User Access” link to the right of the link.
- Click on “Add User(s)”.
- Search for the API user you created. (I searched for last name of “API).
- To the left of the API user in the search results, click on the blue “>>” link to move it to “Added Users” and then click on “Save & Exit”.
- Leave it with the defaults of “Run” and press “Save & Exit” again.
Microsoft PowerBI Setup
- If you do not have the desktop version of Microsoft PowerBI installed on your Windows machine, go to https://powerbi.microsoft.com and click on “Sign up for free” in the top right. Then click “download free”. Install it on your machine.
- Launch PowerBI Desktop (this takes a while on my machine).
- Cancel out of the splash screen.
- Press the “Edit Queries” button in the tool ribbon.
- Press the “New Source” button and then select “Blank Query” and press the “Connect” button.
- Right click on the new query that was created and select “Advanced Editor”.
- PowerBI makes use of a query language that can be used for advanced queries. Because of how the Blackbaud ON API handles authentication, we need to use this advanced query language. Copy the code below into the advanced editor, replacing the code in red with your school’s ON website address, API username/password, and the list ID. When you edit the text, make sure you don’t use smart quotes.
Source = Json.Document(Web.Contents(“https://myschool.myschoolapp.com/api/authentication/login?username=apiusername&password=apipassword&format=json”)),T = Source[Token],
GetList = Function.InvokeAfter(()=>Json.Document(Web.Contents(“https://myschool.myschoolapp.com/api/list/listIDnumber/?t=” & T & “&format=json”)), #duration(0,0,0,5))
- Click on the “Done” button in the Advanced Editor.
- At this point there are a few setting changes related to the PowerBI security model that I don’t quite understand. Next to “Please specify how to connect” press “Edit Credentials.”
- Pick “Anonymous” from the list on the left and press “Connect”.
- Next, you should see an alert “Information is required about data Privacy.” Press the “Continue button.
- In the pop-up to the right of your website URL pick “Public” then press “Save”.
- You should then see results as a column of “Records”. We will need to expand those.
- Right click on the column header and select “To Table”.
- Then an icon will appear on the right side of the column header. Click on it and you will be able to pick what columns of data you want to view from the record. Uncheck “Use original column name as prefix” and then click “OK”.
- Press the “Close & Apply” button on the left side of the tool ribbon.
- Now it’s time for us to build our data visualization!
- On the right side of the screen, click on the first icon “Stacked bar chart”.
- From the right side of the screen, drag the “GradYear” field to the Axis box, and drag “Gender” to “Value” and then drag it again to “Legend”.
- We should now see a chart. My sample data is pretty boring.
- Make sure you’ve clicked on the chart and then click on the paint roller icon.
- Click on “Data colors” on the right and pick a light pink for “F” and a light blue for “M”.
- Turn on “Data Labels”, change the font to a larger size and switch the position to “Inside Center”.
- Resize the box around the chart to make it bigger.
- Now click on the stacked bar chart icon again, and put “GradYear” in the axis and “User ID” in the value field. Note that it automatically switches “User ID” to “Count of User ID”.
- Next click on the “Card” icon (it has the 123 on it). Drag User ID to it’s value box and click on the triangle next to it to switch it to “Count of User ID (Distinct)”.
- Now try clicking on one of the graduation years in the chart of them and notice how the count we just added changed and what it did to the other chart.
- Finally save your file.