Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Hi,
I'm hoping someone can help, I'm having difficulty creating a custom legend to add to a shape map.
I've created three measures to calculate a percentage figure, which works perfectly.
ActualAttendance = CALCULATE(SUM(tSCL_Attendance_For_Dash[MarkTypeStatusID]), tSCL_Attendance_For_Dash[MarkTypeStatusID] <> 2)
PossibleAttendance = CALCULATE(COUNT(tSCL_Attendance_For_Dash[MarkTypeStatusID]), tSCL_Attendance_For_Dash[MarkTypeStatusID] <> 2)
Percentage measure:
PercentageAttendance = DIVIDE([ActualAttendance], [PossibleAttendance], 0)
Then I've created a new calculated column to show as a legend, but also to add a range, however, this doesn't appear to work when I add this to the legend on the shape map.
Legend = SWITCH(TRUE(), [PercentageAttendance] < 0.3, "Less than 30%", AND([PercentageAttendance] >= 0.3, [PercentageAttendance] <= 0.5), "Between 30% and 50%", AND([PercentageAttendance] > 0.5, [PercentageAttendance] <= 0.8), "Between 50% and 80%", "Over 80%")
This adds the legend to the shape map, but doesn't seem to work correctly. It only adds two values, despite there being more percentages that should be assigned to other values. It also doesn't label them correctly, and they all under in the 'Less than 30%' value. This is what the map looks like when adding the legend:
Also when I hover over the map, the tooltip seems to show the percentage figure as 0%.
I've found that I can show the percentage figure in the tooltip by changing the Legend column to the following:
Legend = SWITCH(TRUE(), [PercentageAttendance] < 30, "Less than 30%", AND([PercentageAttendance] >= 30, [PercentageAttendance] <= 50), "Between 30% and 50%", AND([PercentageAttendance] > 50, [PercentageAttendance] <= 80), "Between 50% and 80%", "Over 80%")
However, what that seems to do is show everything in the one value of 'Less than 30%'.
Am I doing this the correct way, or should I be doing something different?
@kevcb226 , Only one legend can be shown.
You can show the Top category. example
Winner/Topper on Map: How to Color States on a Map with Winners/Runner-ups, Top Brand, Top Category : https://community.powerbi.com/t5/Community-Blog/Winner-Topper-on-Map-How-to-Color-States-on-a-Map-wi...
User | Count |
---|---|
89 | |
84 | |
66 | |
62 | |
57 |
User | Count |
---|---|
138 | |
112 | |
94 | |
82 | |
71 |