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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Jeffreyjar
Helper II
Helper II

Match 2 columns from different columns

Hello, 

 

I'm kind of new in power bi so im doing small projects to perform myself,

 im doing a ranking of each agents of a company and each agent has his own code and it is changing every time  

I have an issue on matching 2 columns in different tables 

 

Need help asap

 

 

the old column is "Numero Agents" of the table "APE 02 2022" base on their name

 

 

Numero Agents Noms Agents 
5599000DIRECT BUSINESS
5599000DIRECT BUSINESS
5599000DIRECT BUSINESS
5599000DIRECT BUSINESS
A10299002MENDOUME ERIC VALENTIN
94202301EXPRESS INSURANCE
B50199001YONDO MIYENGA ALICE
A10199018LEHMAN CHARLES FREDERIC
A10199012JIGHEULA WELAPINOU ELIONOR
A10101001NEMY OMOG SERGE FRANCOIS
A10199015NGUEKENG JOLIVETTE LUCIE
A10199012JIGHEULA WELAPINOU ELIONOR
A10199012JIGHEULA WELAPINOU ELIONOR
A10199012JIGHEULA WELAPINOU ELIONOR
A10199006NGONKOLO MARIE MADELEINE
A10199006NGONKOLO MARIE MADELEINE
A10199012JIGHEULA WELAPINOU ELIONOR
A10199006NGONKOLO MARIE MADELEINE
A10101001NEMY OMOG SERGE FRANCOIS
A10199001MBA NEE TENE LEOPOLDINE
A10199015NGUEKENG JOLIVETTE LUCIE

 

 

with this new column  "New Agents Codes" from the table "agent list" base on their name

 

New Agents CodesEAAGTNAME 
A10199003RHODE DORETTE MOSSI EKAME
A10199006NGONKOLO MARIE MADELEINE
A10199007HONTCHEU MONKAM DOMINIQUE
A10199010BEKONO KOMBO JEANNINE CHARLENE
A10199012JIGHEULA WELAPINOU ELIONOR
A10199013SAFEDIEU EDITH VADES
A10199015NGUEKENG JOLIVETTE LUCIE
A10199017NDO FOUDA BERNADETTE CHRISTALE
A10199018LEHMAN CHARLES FREDERIC
A10299002MENDOUME ERIC VALENTIN
A10299004MENI CAROLLE NELLY
A10299005MATHA DORIANNE CLAIRE
A10299006BELLA AWONO ANTOINE ALFRED
A10299007BIENDU KOUAGHU MIKEL FLORE
A10299008TCHANA KUIGOUA EDWIGE
A10299010MANDONG CHRYSTELLE NICOLE
A10299011DJUIDJE FOGAING MARIE CHRISTEL
A10299012MBOM LOTIN BERTHY AURELIE
A10299013NYANDJOU TCHOUMGA PATRICK B.
A10399002TCHAOU STEPHANE
A10399003TCHAMBA NGAHA DONALD
A10399004TCHEUFANG FALONNE
A10399006MANET CHRISTINE PERSIDE GRACE
A10399015CHEBOU CHEKEM ELIANE JOCELYN
A10399016IKOU WELNJEL DANIEL HERVE
A10399018AWOUMOU NGA OWONA VANESSA
1 ACCEPTED SOLUTION
hokeson
Microsoft Employee
Microsoft Employee

 

 

First step you need to do is to deduplicate records in table APE 02 2022.

then you can merge both table based on name to get all combinations.

it depends of usecase. 

 

please see M-code for deduplication

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("tZHBasMwEER/ZfE5B9mtS3NU7KmzibQbJCutCfn/3+jKlEJ6KDQ0CHTZtzPD7OXS9P1265xrNs3ICcNMu5JZkHNz3Txy6lvX1Xln8wgZtUQQEg909gEys6zY9rlz3ZNrjcLHKdk2seSSvAxYgV3v2qpTiUVNhyIvkMmTD/zFmFdl2ldjAvbRCw17nwIyvSWM1fWGq5kOPO1Rgqd3BH9i0UIIrKLpG7W32griQhp1oow0wTQtnXK+0ewrOBUcLRsdNPAZ8wwKZWDcY/4w1L2sSVWOGqxMnxj2jwiw490F/rv5X4pfwbjzJADNEKscetIw/gz5+4Gunw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Numero Agents " = _t, #"Noms Agents" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Numero Agents ", type text}, {"Noms Agents", type text}}),
    #"Removed Duplicates" = Table.Distinct(#"Changed Type", {"Numero Agents "})
in
    #"Removed Duplicates"

 

 

see M-code for merge

 

let
    Source = Table.NestedJoin(#"New Agents codes", {"EAAGTNAME"}, #"APE 02 2022", {"Noms Agents"}, "APE 02 2022", JoinKind.FullOuter),
    #"Expanded APE 02 2022" = Table.ExpandTableColumn(Source, "APE 02 2022", {"Numero Agents ", "Noms Agents"}, {"Numero Agents ", "Noms Agents"})
in
    #"Expanded APE 02 2022"

 

result looks like 

hokeson_0-1656315074738.png

 

View solution in original post

2 REPLIES 2
hokeson
Microsoft Employee
Microsoft Employee

 

 

First step you need to do is to deduplicate records in table APE 02 2022.

then you can merge both table based on name to get all combinations.

it depends of usecase. 

 

please see M-code for deduplication

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("tZHBasMwEER/ZfE5B9mtS3NU7KmzibQbJCutCfn/3+jKlEJ6KDQ0CHTZtzPD7OXS9P1265xrNs3ICcNMu5JZkHNz3Txy6lvX1Xln8wgZtUQQEg909gEys6zY9rlz3ZNrjcLHKdk2seSSvAxYgV3v2qpTiUVNhyIvkMmTD/zFmFdl2ldjAvbRCw17nwIyvSWM1fWGq5kOPO1Rgqd3BH9i0UIIrKLpG7W32griQhp1oow0wTQtnXK+0ewrOBUcLRsdNPAZ8wwKZWDcY/4w1L2sSVWOGqxMnxj2jwiw490F/rv5X4pfwbjzJADNEKscetIw/gz5+4Gunw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Numero Agents " = _t, #"Noms Agents" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Numero Agents ", type text}, {"Noms Agents", type text}}),
    #"Removed Duplicates" = Table.Distinct(#"Changed Type", {"Numero Agents "})
in
    #"Removed Duplicates"

 

 

see M-code for merge

 

let
    Source = Table.NestedJoin(#"New Agents codes", {"EAAGTNAME"}, #"APE 02 2022", {"Noms Agents"}, "APE 02 2022", JoinKind.FullOuter),
    #"Expanded APE 02 2022" = Table.ExpandTableColumn(Source, "APE 02 2022", {"Numero Agents ", "Noms Agents"}, {"Numero Agents ", "Noms Agents"})
in
    #"Expanded APE 02 2022"

 

result looks like 

hokeson_0-1656315074738.png

 

hokeson
Microsoft Employee
Microsoft Employee

Hello,

you can use a formula comparing values and returning requested result. Do you have some sample data and expected result?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.