{"id":44,"date":"2026-09-30T06:31:13","date_gmt":"2026-09-30T06:31:13","guid":{"rendered":"https:\/\/www.datascientist.ca\/blog\/?p=44"},"modified":"2026-10-01T03:36:49","modified_gmt":"2026-10-01T03:36:49","slug":"crime-analysis-case-study-using-power-bi-end-to-end-data-analytics-project","status":"publish","type":"post","link":"https:\/\/www.datascientist.ca\/blog\/crime-analysis-case-study-using-power-bi-end-to-end-data-analytics-project\/","title":{"rendered":"Crime Analysis Case Study using Power BI | End-to-End Data Analytics Project"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/www.youtube.com\/@dataliteracyofficial\" target=\"_blank\" rel=\"noopener\"><\/a><\/p>\n\n\n\n<iframe loading=\"lazy\" title=\"CrimeAnalysisMar5(2)(3)\" width=\"600\" height=\"373.5\" src=\"https:\/\/app.powerbi.com\/view?r=eyJrIjoiZmZmNmEwNmQtOWY4OC00ZmIwLTlhYWEtNjRlODVmMjkwNThlIiwidCI6IjRhNjk1YWI3LWViNzktNDViZS05NTg2LWQ4NTA4ODUwYTY1NSJ9\" frameborder=\"0\" allowFullScreen=\"true\"><\/iframe>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Crime Analysis Case Study using Power BI | End-to-End Data Analytics Project\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/A4PiqucMUpc?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Case study overview: finding crime patterns and high-risk time periods<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This Power BI crime analytics dashboard turns raw incident records into an interactive view of crime patterns, monthly trends and the time periods when risk is highest.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>The business problem.<\/strong> Crime data usually arrives as a long list of incidents. Police services, city planners and community analysts cannot easily see from that list when crime peaks, which offence types are rising, or whether this month is better or worse than last year.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>The solution.<\/strong> A cleaned data model with separate Date and Time tables, DAX measures for incident counts and change over time, and report pages that move from the city-wide trend to a specific offence type, area or time of day.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Who it is for.<\/strong> Law enforcement analysts, city and community safety planners, researchers and journalists, and Power BI learners who want a realistic public-safety project for a portfolio.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The data: crime incident records<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The source is a table of reported crime incidents, with one row per incident. A typical layout includes an incident ID, date and time of occurrence, offence type or category, district or neighbourhood, location description, and sometimes latitude and longitude or an arrest flag. <em>[Adjust this list to the columns in your file, and name the source and date range.]<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Data quality issues to handle<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Date and time often arrive as one text field or as separate fields in mixed formats.<\/li>\n\n\n\n<li>Offence labels vary in spelling and detail, so related offences need grouping into a manageable set of categories.<\/li>\n\n\n\n<li>Some records lack a location or time, so they need an Unknown label rather than being dropped.<\/li>\n\n\n\n<li>Reported incidents are not the same as all crime, because reporting and recording practices differ by area and over time.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Transformation and data model<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Set data types.<\/strong> Convert the occurrence date to Date and the time to Time, and check for failed conversions.<\/li>\n\n\n\n<li><strong>Standardize offence labels.<\/strong> Trim and capitalize text, then group detailed offences into categories such as property, violent and traffic-related.<\/li>\n\n\n\n<li><strong>Create time fields.<\/strong> Add hour of day and a time period column, for example Overnight, Morning, Afternoon and Evening, so high-risk periods can be compared.<\/li>\n\n\n\n<li><strong>Build Date and Time tables.<\/strong> Keep them separate from the incident table. The Date table carries year, month, quarter, weekday and a weekend flag, and is marked as the date table.<\/li>\n\n\n\n<li><strong>Relate the tables.<\/strong> Connect Date and Time to the incident table with one-to-many relationships, and add an offence category table if you want a cleaner slicer.<\/li>\n\n\n\n<li><strong>Keep unknowns.<\/strong> Label missing values rather than removing rows, so totals match the source.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Key DAX measures<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">These measures power the KPI cards, trend lines and time period comparisons. Table and column names are examples, so match them to your model.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Total Incidents = COUNTROWS ( Incidents )\n\nIncidents Last Month =\nCALCULATE ( &#91;Total Incidents], DATEADD ( 'Date'&#91;Date], -1, MONTH ) )\n\nMonth over Month % =\nDIVIDE ( &#91;Total Incidents] - &#91;Incidents Last Month], &#91;Incidents Last Month] )\n\nIncidents Prior Year =\nCALCULATE ( &#91;Total Incidents], SAMEPERIODLASTYEAR ( 'Date'&#91;Date] ) )\n\nYear over Year % =\nDIVIDE ( &#91;Total Incidents] - &#91;Incidents Prior Year], &#91;Incidents Prior Year] )\n\nIncidents YTD =\nTOTALYTD ( &#91;Total Incidents], 'Date'&#91;Date] )\n\nShare of Incidents % =\nDIVIDE ( &#91;Total Incidents], CALCULATE ( &#91;Total Incidents], ALL ( Incidents&#91;OffenceCategory] ) ) )\n\nPeak Hour =\nVAR HourTable =\n    ADDCOLUMNS ( VALUES ( 'Time'&#91;Hour] ), \"@Count\", &#91;Total Incidents] )\nRETURN\n    MAXX ( TOPN ( 1, HourTable, &#91;@Count], DESC ), 'Time'&#91;Hour] )<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The Peak Hour measure returns the hour with the most incidents in the current filter context. If two hours tie, it returns the later one. Time intelligence functions need the marked Date table to work correctly.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Dashboard walkthrough<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Each page answers one question.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><th>Page<\/th><th>Question answered<\/th><th>Main visuals<\/th><\/tr><tr><td>Overview<\/td><td>How many incidents, and how is it changing?<\/td><td>KPI cards, monthly trend, month-over-month and year-over-year change<\/td><\/tr><tr><td>Time periods<\/td><td>When is risk highest?<\/td><td>Weekday by hour heat map, time period bars, peak hour card<\/td><\/tr><tr><td>Offence types<\/td><td>What kinds of crime are most common?<\/td><td>Category ranking, share of total, trend by category<\/td><\/tr><tr><td>Areas<\/td><td>Where are incidents concentrated?<\/td><td>District ranking and map, with rates where population is available<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Design choices that help readers<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The heat map of weekday by hour shows high-risk periods in seconds.<\/li>\n\n\n\n<li>Month-over-month change is paired with year-over-year change, since seasonality can mislead a single comparison.<\/li>\n\n\n\n<li>Slicers for year, offence category and area are synced across pages.<\/li>\n\n\n\n<li>A note on each page states the data source, date range and what counts as an incident.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Insights, business value and lessons learned<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>What the dashboard reveals<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><em>[Time: name the weekday and time period with the most incidents, and the peak hour.]<\/em><\/li>\n\n\n\n<li><em>[Offences: name the top two categories and their share of all incidents.]<\/em><\/li>\n\n\n\n<li><em>[Trend: give the month-over-month and year-over-year change for your selected period.]<\/em><\/li>\n\n\n\n<li><em>[Seasonality: name the months with the highest and lowest counts.]<\/em><\/li>\n\n\n\n<li><em>[Areas: name the district with the most incidents, noting whether you adjusted for population.]<\/em><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Replace each prompt with the figure shown in your embedded dashboard.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Business value<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Planners can match patrols, lighting and community programs to the hours and places that need them.<\/li>\n\n\n\n<li>Leaders can track whether trends are improving, using consistent measures.<\/li>\n\n\n\n<li>One model replaces repeated manual summaries of the same incident list.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Responsible use.<\/strong> Recorded incidents reflect what is reported and how it is recorded, so patterns can partly reflect reporting and enforcement practices. Use the dashboard to ask better questions and allocate resources, and avoid drawing conclusions about individuals or communities from counts alone.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Lessons for Power BI builders<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Separate Date and Time tables make hourly and monthly analysis straightforward.<\/li>\n\n\n\n<li>Compare against both last month and last year to separate trend from seasonality.<\/li>\n\n\n\n<li>Keep unknown values visible, and document how they are handled.<\/li>\n\n\n\n<li>Validate every measure against a manual count before publishing.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently asked questions<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>What is a crime analytics dashboard?<\/strong> It is an interactive report that summarizes incident data by time, offence type and area, so analysts can spot patterns, trends and high-risk periods.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>How do you find high-risk time periods in Power BI?<\/strong> Split the incident time into hour and time period fields, then use a weekday-by-hour matrix or heat map to show when incident counts are highest.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Which DAX functions are used for crime trends?<\/strong> Common choices are <code>DATEADD<\/code> for month-over-month change, <code>SAMEPERIODLASTYEAR<\/code> for year-over-year change and <code>TOTALYTD<\/code> for year-to-date totals.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Why do I need a separate Date table?<\/strong> A marked Date table is required for reliable time intelligence, and it gives you year, month, quarter and weekday fields for slicing.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Can this approach work for other incident data?<\/strong> Yes. The same design works for traffic collisions, emergency calls, safety incidents and other event data with a date and time.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Try it yourself<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Watch the full tutorial, then download the <a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/drive.google.com\/drive\/folders\/10ji6BjeBQ-B12-w1trf3NTDameKfW3ek?usp=sharing\">project files<\/a> and build the dashboard yourself. Need a custom public safety or operations dashboard? Contact datascientist.ca.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Case study overview: finding crime patterns and high-risk time periods This Power BI crime analytics dashboard turns raw incident records [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1],"tags":[8,9,13],"class_list":["post-44","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-dashboard-tutorial","tag-power-bi","tag-power-bi-for-beginners"],"_links":{"self":[{"href":"https:\/\/www.datascientist.ca\/blog\/wp-json\/wp\/v2\/posts\/44","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.datascientist.ca\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.datascientist.ca\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.datascientist.ca\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.datascientist.ca\/blog\/wp-json\/wp\/v2\/comments?post=44"}],"version-history":[{"count":2,"href":"https:\/\/www.datascientist.ca\/blog\/wp-json\/wp\/v2\/posts\/44\/revisions"}],"predecessor-version":[{"id":68,"href":"https:\/\/www.datascientist.ca\/blog\/wp-json\/wp\/v2\/posts\/44\/revisions\/68"}],"wp:attachment":[{"href":"https:\/\/www.datascientist.ca\/blog\/wp-json\/wp\/v2\/media?parent=44"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.datascientist.ca\/blog\/wp-json\/wp\/v2\/categories?post=44"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.datascientist.ca\/blog\/wp-json\/wp\/v2\/tags?post=44"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}