Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hi guies,
im new in this community and in pbi desktop using...
i need to offer to user a slicer to select the number of classes (N) and than classify my fact table measure in N groups, to use that to show a shapemap with saturation based on that groups and to show a color legend based on that N groups.
for example , my fact table have this values (district name, birth numbers):
torino, 3 births
cuneo, 5 births
vercelli, 15 birts
if user select 3 groups from slicer/filter, shapemap show 3 districts: torino, cuneo and vercelli (everyone with different colors)
if user select 2 groups from slicer/filter, shapemap show 3 districts, but 2 of theme (torino and cuneo) with the same color, ad vercelli with a second different color
a think i need to use ranking or percentiles but, i dont know how to do...
can anyone helps me ?
thanks a lot
bye
mauro
Solved! Go to Solution.
Hi @rufmau68_ozvvj ,
Since you need to group dynamically and the calculated columns can't change dynamically, we can only create a measure to implement the grouping, but due to the design, the measure can't be placed on the legend field and the shape map doesn't support conditional formatting of the colors, so we can create a filled map instead.
Here are my steps you can follow as a solution.
(1)Create tables.
SlicerTable = GENERATESERIES(1,20,1)
Slicer2 = GENERATESERIES(1,20,1)
(2)Create measures.
Measure =
RANKX(ALLSELECTED('Table'),[birth numbers],MAX('Table'[birth numbers]),DESC,Dense)
Measure 3 = var a=MAXX(ALLSELECTED('Slicer2'[Value]),[Value])
VAR B=MAXX(ALLSELECTED('Table'[district name]),[Measure])
VAR C= ROUNDDOWN(B/a,0)
var d= ADDCOLUMNS(ALLSELECTED(SlicerTable[Value]),"test",SWITCH(TRUE(),[Value]<a,CONCATENATEX(GENERATESERIES(([Value]-1)*C+1,[Value]*C,1),[Value],","),[Value]=a,CONCATENATEX(FILTER(ALLSELECTED('Table'),[Measure]>=([Value]-1)*C+1&&[Measure]<=b),[Measure])))
RETURN MAXX(FILTER(d,[Value] in VALUES(SlicerTable[Value])),[test])
Measure 4 = MAXX(FILTER(SlicerTable,CONTAINSSTRING([Measure 3],[Measure])),[Value])
Color = SWITCH(TRUE(),
[Measure 4]=1,"blue",
[Measure 4]=2,"red",
[Measure 4]=3,"yellow")
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @rufmau68_ozvvj ,
Since you need to group dynamically and the calculated columns can't change dynamically, we can only create a measure to implement the grouping, but due to the design, the measure can't be placed on the legend field and the shape map doesn't support conditional formatting of the colors, so we can create a filled map instead.
Here are my steps you can follow as a solution.
(1)Create tables.
SlicerTable = GENERATESERIES(1,20,1)
Slicer2 = GENERATESERIES(1,20,1)
(2)Create measures.
Measure =
RANKX(ALLSELECTED('Table'),[birth numbers],MAX('Table'[birth numbers]),DESC,Dense)
Measure 3 = var a=MAXX(ALLSELECTED('Slicer2'[Value]),[Value])
VAR B=MAXX(ALLSELECTED('Table'[district name]),[Measure])
VAR C= ROUNDDOWN(B/a,0)
var d= ADDCOLUMNS(ALLSELECTED(SlicerTable[Value]),"test",SWITCH(TRUE(),[Value]<a,CONCATENATEX(GENERATESERIES(([Value]-1)*C+1,[Value]*C,1),[Value],","),[Value]=a,CONCATENATEX(FILTER(ALLSELECTED('Table'),[Measure]>=([Value]-1)*C+1&&[Measure]<=b),[Measure])))
RETURN MAXX(FILTER(d,[Value] in VALUES(SlicerTable[Value])),[test])
Measure 4 = MAXX(FILTER(SlicerTable,CONTAINSSTRING([Measure 3],[Measure])),[Value])
Color = SWITCH(TRUE(),
[Measure 4]=1,"blue",
[Measure 4]=2,"red",
[Measure 4]=3,"yellow")
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.