The primary rule of thumb is PBI does NOT like 2-d dataset; unpivot it.
The measure itself is not complex,
Check =
FORMAT (
IF (
HASONEVALUE ( DATA[Profile] ),
MAXA ( DATA[Value] ),
DISTINCTCOUNT ( DATA[Value] ) - 1
),
"\Y;;\N"
)
The tricky part is how to make use of "Column subtotals"
of Matrix viz to display the result,