This is our last week using the Nobel Prize data. We are again looking at the age of the laureate when they were awarded the prize. This time we will examine it using a histogram. Histograms measure the distribution of data within defined ranges. So we are calculating age and creating bins of equal sizes. Then we’ll look at laureate age by prize category.
A quick reminder – you can create your own free Microsoft 365 developer account to learn Power BI. More information about developer accounts can be found here.
Retrieve the data from the API using the following URL: https://masterdataapi.nobelprize.org/2.1/laureates?offset=0&limit=1200 (Hint: Power BI can expand the dataset into a table for you!)
- Expand the data as needed to include the laureates’ id, birth date, death date, award year, prize category, and date awarded.
- Calculate the integer age of the laureate based upon the given birth date, death date, and date awarded.
- If date awarded is not available, assume it is January 1 of the award year.
- For birth dates that contain an invalid month or day, change the date to January 1 of the given year.
- Be sure to check if the death date is before the award date in your calculation.
- Use a column chart to create a histogram that contains 8 age bins of equal size (when prize category is not filtered) and shows the frequency a laureate was awarded in each age bin. This can be done using the binning functionality or by writing DAX.
- Add a visual of your choice to allow users to select a prize category to see how the distribution changes for each category.
- Add a visual of your choice that states the number of laureates whose age is unknown, the youngest laureate at the time of the award, and the oldest laureate at the time of the award.
- Ensure that the visual containing the age information is not filtered by the histogram but is filtered by the prize category selection.
- Determine which prize category skews older, with no laureates younger than their forties and the largest portion in their sixties and seventies.
This challenge uses data provided by the Nobel Prize organization. You may reference the documentation at https://www.nobelprize.org/about/developer-zone-2/. This week’s data can be retrieved with the following url: https://masterdataapi.nobelprize.org/2.1/laureates?offset=0&limit=1200. The data is free to use and contains information about the Nobel Prizes and the Nobel Laureates. The data is updated as the information on www.nobelprize.org is updated, including at the time of announcements of new Laureates.
After you finish your workout, share on Twitter using the hashtags #WOW2021 and #PowerBI, and tag @JSBaucke, @MMarie, @shan_gsd and @dataveld. Also make sure to fill out the Submission Tracker so that we can count you as a participant this week in order to track our participation throughout the year.
4 thoughts on “2021 Week 26 | Power BI: Make a Histogram with Equal Size Bins”
I’ve never seen the slider formatted like this. Is it a custom tile or a way of formatting?
Attempted the challenge and my slicer still lists the numerical values in boxes.
Hi, Will. Good question. The slider on the left of the histogram is the built-in zoom slider with y-axis on, slider labels off, and slider tooltips on. You can find it in the formatting pane for the column chart visual.
I used #date to my DAX formula, but it shows “Token Eof expected.”
#date is an M (Power Query) language construct, not DAX. I’d need more details about where/why you were using that function to be able to help you.