Forum Discussion
Anonymous
2 years agoNot applicable
Mapping a column between two tables
I have this calculated table in power bi, that give me the unique department with its division and city and country, and don't forget it's calculated table with the following measure UniqueCombinati...
- 2 years ago
Anonymous OK, so I would think you would first need to modify your calculated table to this:
UniqueCombinationSummary = ADDCOLUMNS( SUMMARIZE( 'SQL_Database_Website', 'SQL_Database_Website'[Department], 'SQL_Database_Website'[City], 'SQL_Database_Website'[Country], 'SQL_Database_Website'[Division], "UniqueDivisionCount", DISTINCTCOUNT('SQL_Database_Website'[Division]) ), "Key", [Department] & "|" & [City] & "|" & [Country] & "|" & [Division] )Then in your other table, a calculated column like this:
Division = VAR __Department = [Department] VAR __City = [City] VAR __Country = [Country] VAr __Result = MAXX( FILTER( 'UniqueCombinationSummary', [UniqueDivisionCount] = 1, [Department] = __Department, [City] = [City], [Country] = __Country ), [Division] ) RETURN __ResultAnd then another calculated column in that table:
Key = [Department] & "|" & [City] & "|" & [Country] & "|" [Division]Then relate your tables on the Key columns.
Greg_Deckler
Community Champion
2 years agoAnonymous OK, so I would think you would first need to modify your calculated table to this:
UniqueCombinationSummary =
ADDCOLUMNS(
SUMMARIZE( 'SQL_Database_Website',
'SQL_Database_Website'[Department],
'SQL_Database_Website'[City],
'SQL_Database_Website'[Country],
'SQL_Database_Website'[Division],
"UniqueDivisionCount", DISTINCTCOUNT('SQL_Database_Website'[Division]) ),
"Key", [Department] & "|" & [City] & "|" & [Country] & "|" & [Division]
)
Then in your other table, a calculated column like this:
Division =
VAR __Department = [Department]
VAR __City = [City]
VAR __Country = [Country]
VAr __Result =
MAXX(
FILTER(
'UniqueCombinationSummary',
[UniqueDivisionCount] = 1,
[Department] = __Department,
[City] = [City],
[Country] = __Country
),
[Division]
)
RETURN
__Result
And then another calculated column in that table:
Key = [Department] & "|" & [City] & "|" & [Country] & "|" [Division]
Then relate your tables on the Key columns.