Posts

Showing posts from November, 2018

Visuals and the wonderful mysteries of the CALCULATE function

Image
I haven't really talked about visuals much as they're mostly pretty intuitive in BI but there is an issue if you want to produce a graph like this as the obvious steps won't get you there. So that's a bar chart showing the percentage of kids of each gender at low, middle high prior attainment from this Students table. But if you create the bar chart with Gender as the Axis, Prior Attainment as the Legend and Count of student ID as the value you get this: If you click the down arrow next to count of studentid you can use 'show value as....percent of grand total'  but that gives you: (note figures were added by going to the format (roller paint icon of the visual) and turning data labels on) The problem here is that the totals for each segment are being divided by all pupils not by Male/Female totals respectively. Row and Filter Context We can sort this out, but to understand how we need to understand two very important concepts in power

Looking back in time: Historical Group Membership

In this post I'm going to show how look back in time at your school population on or between two dates. At Bromcom we've just added information on class, year memberships etc which we are calling 'collections' of pupils to distinguish them from the Year and Tutor  Group  fields on the Students table. Our database structure for this is pretty logical: Collections : A master list of groups with IDs and a group type (today I'm using the example of Year Groups which have the CollectionTypeName "OnRollYGrp") Collection Associates : A group memberships table that lists Collection IDs, StudentIDs and the Start and End dates of the membership of the group. CollectionAssociates should relate to Students on SchoolStudentId and to Collections on SchoolCollectionId If you want to play along you can download an excel file with these tables  here Count Members of a year group The first step is to make a measure on CollectionAssociates counting

Static Data Tables and Sorting Year Groups

Image
It's often useful to have static data tables in your BI model (one recent example for me is converting ethnicity codes to census categories) and I've been through a process of trial and error to find the best way of doing this. Import from Excel/CSV This is the most obvious: Get Data, Excel, Bosh! But unless you're only going to update your data from PBI Desktop it's not a good idea. If you have Excel/CSV data sources in the file then you can't schedule refresh from  app.powerbi.com .  (you can if you set up a "gateway" and turn your machine into a server but, trust me, this isn't worth it) Google Sheet Next option is a Google Sheet and note that it must be a Google sheet, not simply an xlsx uploaded to Drive.  (Wondering why not an Excel 365 file as it's MICROSOFT Power BI? Hahahaha - you work it out then tell me how please ;)  To connect that to BI: Hit the share button top right hand side of the screen and edit the li