POWER BI COURSE · LESSON 16
Goal: Let readers choose a product category by clicking a picture, then watch the sales chart and total update. You will use Power BI's built-in image support, so this beginner exercise does not need a custom visual.
Picture choice → filter → result
Selected: Books → Total sales: 150 → chart shows Books only
1. Make a tiny practice table
In Power BI Desktop, choose Home → Enter data. Name the table Sales and enter these rows. The numbers are intentionally small so you can check the result without a calculator.
| Category | Product | Amount |
|---|---|---|
| Books | Notebook | 90 |
| Books | Guide | 60 |
| Games | Puzzle | 120 |
| Art | Brush | 40 |
Create a measure from Modeling → New measure:
Total Sales = SUM(Sales[Amount])
2. Start with a working text slicer
- Add a Button slicer to the report canvas and place
Sales[Category]in its field well. - Add a Card for
[Total Sales]and a bar chart with Category on the axis and[Total Sales]as the value. - Click Books. The card should say 150. Clear the selection and it should say 310.
The text version is your fallback. It remains useful if the reader's connection blocks images.
3. Add your own pictures
For a real picture slicer, prepare three small images that you own, one for each category. Host them at stable URLs accessible to report viewers. Add a CategoryImageURL column with each category's image URL; each Books row should use the same Books image URL. In Table view, select the URL column and set Column tools → Data category → Image URL. Add the image field to the slicer and format image size and labels. Depending on the current Power BI visual and release, the List slicer or Button slicer offers picture and label options. Keep the category name visible so the choice is understandable even if the image fails to load.
C:\\Pictures\\books.png will not work for other readers. Do not put private data into a public image URL.4. Check the interaction
Choose Games and confirm the card reads 120. Choose Art and confirm 40. If the chart does not change, select the slicer and use Format → Edit interactions to check that it filters the chart. If a picture is blank, test its URL in a private browser window and confirm the field's data category is Image URL.
Practice and next step
Add a fourth category, such as Music, with two sales rows and your own image. Predict the total before selecting it. On a narrow report page, use two columns of buttons and test that labels remain readable.
← Power BI course roadmap · Review ordinary slicers
Further reading: Microsoft: images in reports and slicers · Microsoft: button slicer. Example data and diagram are original to this blog.
No comments:
Post a Comment
Please do not enter any spam link in the comment box.