Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not 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
UniqueCombinationSummary = 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]) )

and I also have a table called Viva Members Demographics and in the table, there is column (Department, City, country) the department and city and country column's values are almost matching the same columns in UniqueCombinationSummary and same wording, but there is no value for division, what i want is to be mapping the two table so i can know what is the division for the each existing department and city and country from Viva Members Demographics and exist in UniqueCombinationSummary for example if i have in UniqueCombinationSummary table a department called DAta analytics, and the city of it is New York, and the counrty is US and the division is Finance, while in the Viva Members Demographics table i have only department called DAta analytics, and the city of it is New York, and the counrty is US but i don't know what is the division, i don't have the data, we i need to check what is the division in UniqueCombinationSummary and write it in the new calculated column in Viva Members Demographics table and in this example it's Finance, but with very impotant considion, that only when the value in UniqueDivisionCount column is 1 so we can get only the unique matching division with its department, city and country

Also the relationship between the two tables is not working, what is the best way to do the mapping and get division data. 

Thanks a lot in advanced.

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@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
  __Result

And then another calculated column in that table:

Key = [Department] & "|" & [City] & "|" & [Country] & "|" [Division]

Then relate your tables on the Key columns.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

1 REPLY 1
Greg_Deckler
Community Champion
Community Champion

@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
  __Result

And then another calculated column in that table:

Key = [Department] & "|" & [City] & "|" & [Country] & "|" [Division]

Then relate your tables on the Key columns.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Top Solution Authors