Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
How?
First, you need a SVG map, you could get them from https://www.amcharts.com/svg-maps/
Download the map and copy the code to Power BI.
Add a new measure, paste the SVG code:
The map could be shown by HTML Content:
Second, you need XY Value for every location.
Third, creat the chart measure:
Column_Chart_Map=
VAR MAX_Value =
MAXX ( ALL ( 'table'[Province] ), [value] )
VAR MAX_Width = 40
VAR FontSize = 12
VAR Chart =
CONCATENATEX (
'table',
"<text x='" & [坐标轴_X] & "' y='" & [坐标轴_Y] + FontSize + 1 & "' text-anchor='start' font-size='" & FontSize & "' fill='Grey'>" & [Province] & "</text>" &
"<rect rx='1' x='" & [坐标轴_X] - 5 & "' y='" & [坐标轴_Y] + FontSize + 1 - MAX_Width * [value] / MAX_Value & "'height='" & MAX_Width * [value] / MAX_Value & "'width='5' fill='"
& IF ( [value] >= 50, "DarkCyan", "Tomato" ) & "'/>"
)
RETURN
SUBSTITUTE ( [MAP], "</svg>", Chart & "</svg>" )
Image_Map=
VAR MAX_Value =
MAXX ( ALL ( 'table'[Province] ), [value] )
VAR MAX_Width = 40
VAR FontSize = 12
VAR image = "http://*****.com/****.png
VAR imagemap =
CONCATENATEX (
'table',
"<image xlink:href='" & image & "' x='" & [坐标轴_X] & "' y='" & [坐标轴_Y] & "' width='" & MAX_Width * [value] / MAX_Value & "' height='" & MAX_Width * [value] / MAX_Value & "'></image>" & "<text x='" & [坐标轴_X] & "' y='" & [坐标轴_Y] + FontSize + 1 & "' text-anchor='start' font-size='" & FontSize & "' fill='Black'>" & [Province] & "</text>"
)
RETURN
SUBSTITUTE ( [MAP], "</svg>", imagemap & "</svg>" )
Again, you could see the result by HTML content.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 |