Skip to content

Instantly share code, notes, and snippets.

@Hugoberry
Created January 18, 2024 12:56
Show Gist options
  • Save Hugoberry/8d021478f3114c14e816adb35fb00e4a to your computer and use it in GitHub Desktop.
Save Hugoberry/8d021478f3114c14e816adb35fb00e4a to your computer and use it in GitHub Desktop.
A worked example of using the undocumented DAX function KMeansClustering
evaluate
var sample =
{
("L", 5),
("N", 5),
("P", 7),
("E", 9),
("U", 11),
("Y", 11),
("V", 29),
("H", 31),
("G", 34),
("S", 35),
("K", 41),
("I", 42),
("A", 44),
("D", 53),
("T", 58),
("Q", 66),
("O", 67),
("Z", 67),
("X", 68),
("B", 69),
("C", 77),
("R", 77),
("J", 85),
("F", 91),
("M", 91)
}
return
KMeansClustering(
sample,
{("[Value2]", "Attribute"),("[Value1]", "Item")},
{("[Value1]", BLANK()),("ClusterId", "ClusterId")},
-1
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment