Forum Discussion
Unique Values Across Two Columns Using SUMMARIZE
- 11 months ago
Hi,
PBI file attached.
Hope this helps.
Team Summary =
SUMMARIZE (
UNION (
SELECTCOLUMNS ( 'All Results', "Team", [HomeTeam], "IsHome", 1, "GoalsFor", [Home], "GoalsAgainst", [Away] ),
SELECTCOLUMNS ( 'All Results', "Team", [AwayTeam], "IsHome", 0, "GoalsFor", [Away], "GoalsAgainst", [Home] )
),
[Team],
"Home Games", CALCULATE ( COUNTROWS ( 'All Results' ), [IsHome] = 1 ),
"Away Games", CALCULATE ( COUNTROWS ( 'All Results' ), [IsHome] = 0 ),
"Home Goals Scored", CALCULATE ( SUM ( [GoalsFor] ), [IsHome] = 1 ),
"Away Goals Scored", CALCULATE ( SUM ( [GoalsFor] ), [IsHome] = 0 ),
"Goals Conceded Home", CALCULATE ( SUM ( [GoalsAgainst] ), [IsHome] = 1 ),
"Goals Conceded Away", CALCULATE ( SUM ( [GoalsAgainst] ), [IsHome] = 0 )
)
This creates one summary table with:
Home/Away Games
Goals scored (home/away)
Goals conceded (home/away)
- Ormy26911 months agoFrequent Visitor
Hi Shahid12523,
I think this is getting close, but the DAX returs some errors. Hovering the mouse over IsHome, GoalsFor and GoalsAgainst shows an error of "Cannot find Name". Also, a second error of "Parameter is not the correct type" for GoalsFor and GoalsAgainst. Does there need to be a table reference here?