Introduction
Welcome back to Workout Wednesday! If you’re joining us for the first time, welcome! We present you with a challenge, a dataset to recreate the challenge, and a solution video or file. You can use these challenges to build your skills and your portfolio!
This week we’re exploring the error bars feature in Power BI. Error bars add context to a chart, and can give readers an idea of how precise a measurement is. Error bars can also give readers an idea of how far from the reported value the true value might be. We’re going to build a report looking at mammalian sleeping habits using the error bar feature!
Requirements
- Use the web connector in Power BI to get data from GitHub.
- Assign data types to each column. Remove NA values, rename columns, and load data to the model.
- Create measures for the min and max hours of sleep per day.
- Create groups using the body weight field.
- I grouped animals into small, medium, large, and extra-large.
- Create 2 bar charts, displaying the average:
- Sleep habits by size.
- Sleep habits by feeding type.
- Use the error bars feature in the analytics pane to add the upper and lower values to each bar chart.
- Use the min and max measures you created for the upper and lower bounds of the error bars.
- Set the canvas size to fit your visuals. My canvas size is 1100 x 900.
- Add any other visuals that speak to you as you explore this dataset! Make the design your own and have fun with it!
Dataset
This challenge uses the msleep dataset that is frequently used in R tutorials. The version of the dataset we’re using can be found on Hadley Wickham’s GitHub page.
Use “Get data from Web” in Power BI.
Share
After you finish your workout, share on Twitter using the hashtags #WOW2022 and #PowerBI, and tag @JSBaucke, @MMarie, @shan_gsd, @KerryKolosko, and @NerdyWithData. 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.
Solution
Download the completed .pbix file.
Can you help understand how to remove rows with NA values?
Hi Sam,
You can use a find and replace in Power Query to replace NA values with null values. After that, you’ll be able to set your data types appropriately.
https://docs.microsoft.com/en-us/power-query/replace-values
I hope this helps!
I’m also wondering if I misinterpreted your question – in the sample I used a report level filter to filter out the animals with a feeding type of NA.
https://docs.microsoft.com/en-us/power-bi/create-reports/power-bi-report-add-filter?tabs=powerbi-desktop
Very good thank you