Forum Discussion

Jeffreyjar's avatar
Jeffreyjar
Icon for Helper II rankHelper II
4 years ago
Solved

update a column value from different tables

Hello everyone, 

 

AlexisOlson 

 

please help i have an issue

 

i want to update the column values(Numero Agents) of my APE 02 2022 table

Numero AgentsDDS_X1_SPLITDDS_CA_MPREMDDS_CA_QPREMDDS_CA_SPREMDDS_CA_APREMAPE per agents
A999990090,52000057332111997219160120000
A9999900912500071777140333274722300000
A999990090,53000086222168667330279180000
A999990090,52010057620112563220271120600
A999990090,52020057911113133221388121200
A999990090,535000100668197002385836210000
A799990210,51000002884445653331108055600000
A799990210,51000002884455653341108057600000
A799990210,550000144000282000552500300000
A799990210,51000002884455653341108057600000
A799990210,550000144000282000552501300000
A799990210,550000144000282000552501300000
A999990090,52000057333111999219165120000

 

with my columns(New Agents Codes and associate their names(EEAGTNAME)) of the table *agents list*

EAAGENTEAAGTNAMEEAADDR1EACITYEAFCREASTATUSNew Agents Codes
A99999009MOUAFFI SINDEU BRICE CEDRICK YAOUNDEA99901001AA99901001
A79999021ATSOL NDONGO NATHALIA YAOUNDEA79901001AA79901001

 

so that i could have this final data

Numero AgentsDDS_X1_SPLITDDS_CA_MPREMDDS_CA_QPREMDDS_CA_SPREMDDS_CA_APREMAPE per agentsNew Numero AgentsNames 
A999990090,52000057332111997219160120000A99901001MOUAFFI SINDEU BRICE CEDRICK
A9999900912500071777140333274722300000A99901001MOUAFFI SINDEU BRICE CEDRICK
A999990090,53000086222168667330279180000A99901001MOUAFFI SINDEU BRICE CEDRICK
A999990090,52010057620112563220271120600A99901001MOUAFFI SINDEU BRICE CEDRICK
A999990090,52020057911113133221388121200A99901001MOUAFFI SINDEU BRICE CEDRICK
A999990090,535000100668197002385836210000A99901001MOUAFFI SINDEU BRICE CEDRICK
A799990210,51000002884445653331108055600000A79901001ATSOL NDONGO NATHALIA
A799990210,51000002884455653341108057600000A79901001ATSOL NDONGO NATHALIA
A799990210,550000144000282000552500300000A79901001ATSOL NDONGO NATHALIA
A799990210,51000002884455653341108057600000A79901001ATSOL NDONGO NATHALIA
A799990210,550000144000282000552501300000A79901001ATSOL NDONGO NATHALIA
A799990210,550000144000282000552501300000A79901001ATSOL NDONGO NATHALIA
A999990090,52000057333111999219165120000A79901001ATSOL NDONGO NATHALIA

 

  • PaulDBrown's avatar
    PaulDBrown
    4 years ago

    Create a new column using:

    New Numero Agent = 
    LOOKUPVALUE('table *agents list*'[New Agents Codes],'table *agents list*'[EAAGENT], 'APE 02 2022 table'[Numero Agents])

     

10 Replies

  • rbriga's avatar
    rbriga
    Icon for Impactful Individual rankImpactful Individual

    It is a matter of a join, or "merge queries" in the Query Editor.

    1. Add this 2 sources as queries.

    2. For the first table, go to the query editor and click "Merge Queries"

    3. Merge the 2 queries based on Numero Agents in table 1 and EAAGENT in table 2

    4. extend table 1 to hold New Numero Agents from table 2

     

    See this page, under "combine queries".

    • Jeffreyjar's avatar
      Jeffreyjar
      Icon for Helper II rankHelper II

      I cannot do that with power query because New Agents Codes is a calculated column

       

      Dax functions(formulas) are needed

      • rbriga's avatar
        rbriga
        Icon for Impactful Individual rankImpactful Individual

        How about creating a relationship between the two tables, based on Numero Agents in table 1 and EAAGENT in table 2?

        You can then use the New Agents Codes in any tabe you display as a visual.

         

        You can create a table using one of the table functiones, but the above solution should do.

  • there is already a relationship between them, but it is more complicated than you think i just need a solution for the problem requested with an example if possible

     

    • PaulDBrown's avatar
      PaulDBrown
      Icon for Community Champion rankCommunity Champion

      If there is a relationship between the two tables,

       

       

       

       

      you can add a new column using:

      Agent Name =
      RELATED ( 'table *agents list*'[EAAGTNAME] )

      If there isn't a relationship,

      you can use:

      Agent Name = LOOKUPVALUE('table *agents list*'[EAAGTNAME],'table *agents list*'[EAAGENT], 'APE 02 2022 table'[Numero Agents])

       



       

  • Thank you, the second solution worked for me,but you have done only for the names what about the codes the new ones

     

     

  • PaulDBrown's avatar
    PaulDBrown
    Icon for Community Champion rankCommunity Champion

    Sorry, I'm not sure what you mean. Can you expand on what else you need?

    • Jeffreyjar's avatar
      Jeffreyjar
      Icon for Helper II rankHelper II

      this is the expected data sample that i want to look like

      EEAGENT has old values. New Agents Codes are the new ones

       

      So i want to return New Agents Codes values

       

      Numero AgentsDDS_X1_SPLITDDS_CA_MPREMDDS_CA_QPREMDDS_CA_SPREMDDS_CA_APREMAPE per agentsNew Numero AgentsNames 
      A999990090,52000057332111997219160120000A99901001MOUAFFI SINDEU BRICE CEDRICK
      A9999900912500071777140333274722300000A99901001MOUAFFI SINDEU BRICE CEDRICK
      A999990090,53000086222168667330279180000A99901001MOUAFFI SINDEU BRICE CEDRICK
      A999990090,52010057620112563220271120600A99901001MOUAFFI SINDEU BRICE CEDRICK
      A999990090,52020057911113133221388121200A99901001MOUAFFI SINDEU BRICE CEDRICK
      A999990090,535000100668197002385836210000A99901001MOUAFFI SINDEU BRICE CEDRICK
      A799990210,51000002884445653331108055600000A79901001ATSOL NDONGO NATHALIA
      A799990210,51000002884455653341108057600000A79901001ATSOL NDONGO NATHALIA
      A799990210,550000144000282000552500300000A79901001ATSOL NDONGO NATHALIA
      A799990210,51000002884455653341108057600000A79901001ATSOL NDONGO NATHALIA
      A799990210,550000144000282000552501300000A79901001ATSOL NDONGO NATHALIA
      A799990210,550000144000282000552501300000A79901001ATSOL NDONGO NATHALIA
      A999990090,52000057333111999219165120000A79901001ATSOL NDONGO NATHALIA
      • PaulDBrown's avatar
        PaulDBrown
        Icon for Community Champion rankCommunity Champion

        Create a new column using:

        New Numero Agent = 
        LOOKUPVALUE('table *agents list*'[New Agents Codes],'table *agents list*'[EAAGENT], 'APE 02 2022 table'[Numero Agents])