@Anferrig,
Great progress. You clearly mastered the use of EARLIER (one of the more confusing DAX functions IMO) quickly, and are using it exactly as envisioned to identify the tie pools. I started working on a CROSSJOIN application of the three-way tie pool when I realized if we are going to make this work end-to-end, we are going to need to take a different approach. Rather than starting with DAX, I think we should pull the data directly into Power Query from the web, clean it, identify the tie pools via PQ Groupby, break out the tie pool rows into separate supporting tables, merge them with the head-to-head data all still in PQ and THEN perhaps start our DAX work.
Tonight, I worked out how to automatically identify the tie pools, number them, count the members in each pool, and identify the specific members using the PQ Group by, Aggregate and Index functions. Iāve attached my PBIX so that you can look at the individual applied steps, and hereās the M code:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("TZDBDoIwDIbfZWcOikLgqEaNRo0RPREOTVi0ybaSDTj49K4bCR6/b3+7tnUtzsMoTT84kYhyIZqkFjfoSKHnogy86UGB6cGbPJqT6aWd8Yr+nbEI+CAdsnmgJ1k0xLwKfIEvMmaxtgLdtT7CFVlMbEnR27BYr6eMc4OXbGLk1aKRTs6i6kAxpYEOSNYvhbHJMrgdvBWCxdncweq/wFEaYlzFLfZ6usLEB0vOL2L40zSLLT8oR54q9Ydrfg==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Squad = _t, Points = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Squad", type text}, {"Points", Int64.Type}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Points"}, {{"All Rows", each _, type table [Squad=text, Points=number]}, {"Dist", each Table.RowCount(Table.Distinct(_)), type number}}),
#"Expanded All Rows" = Table.ExpandTableColumn(#"Grouped Rows", "All Rows", {"Squad"}, {"Squad"}),
#"Grouped Rows1" = Table.Group(#"Expanded All Rows", {"Points", "Dist"}, {{"All Rows", each _, type table [Points=number, Squad=text, Dist=number]}}),
#"Filtered Rows" = Table.SelectRows(#"Grouped Rows1", each ([Dist] <> 1)),
#"Added Index" = Table.AddIndexColumn(#"Filtered Rows", "Index", 1, 1),
#"Renamed Columns" = Table.RenameColumns(#"Added Index",{{"Index", "Tie Pool Number"}, {"Dist", "Number Squads in Tie Pool"}}),
#"Expanded All Rows1" = Table.ExpandTableColumn(#"Renamed Columns", "All Rows", {"Squad"}, {"Squad"}),
#"Reordered Columns" = Table.ReorderColumns(#"Expanded All Rows1",{"Squad", "Points", "Tie Pool Number", "Number Squads in Tie Pool"})
in
#"Reordered Columns"
Next step I think is will need to figure out how to dynamically break down each tie pool automatically into a separate table and merge it with the head-to-head data. Agree?
Long ways to go, but I think weāre making progress.
Do you have a website where we can pull all the data we need directly in through the PBI web connector?