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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
arvindarvind24
Helper II
Helper II

Concatenate two data from different tables without reference

Concatenate two data from different tables without reference

Sample data and output
Style No.(Table1)Region(Table2)Concatenate(Output)
ABCD03700IBIHARABCD03700I,BIHAR
ABCD06299BLR, MYS & TMKRABCD03700I,BLR, MYS & TMKR
ABCD08461UTTAR PRADESHABCD03700I,UTTAR PRADESH
ABCD08684BTAMIL NADUABCD03700I,TAMIL NADU
ABCD08684ETELANGANAABCD03700I,TELANGANA
ABCD09297ORISSAABCD03700I,ORISSA
ABCD09302MH,GOA & GJABCD03700I,MH,GOA & GJ
ABCD09351DL & PBABCD03700I,DL & PB
ABCD09778 ABCD06299,BIHAR
ABCD09838B ABCD06299,BLR, MYS & TMKR
  ABCD06299,UTTAR PRADESH
  ABCD06299,TAMIL NADU
  ABCD06299,TELANGANA
  ABCD06299,ORISSA
  ABCD06299,MH,GOA & GJ
  ABCD06299,DL & PB
  ABCD08461,BIHAR
  ABCD08461,BLR, MYS & TMKR
  ABCD08461,UTTAR PRADESH
  ABCD08461,TAMIL NADU
  ABCD08461,TELANGANA
  ABCD08461,ORISSA
  ABCD08461,MH,GOA & GJ
  ABCD08461,DL & PB
  ABCD08684B,BIHAR
  ABCD08684B,BLR, MYS & TMKR
  ABCD08684B,UTTAR PRADESH
  ABCD08684B,TAMIL NADU
  ABCD08684B,TELANGANA
  ABCD08684B,ORISSA
  ABCD08684B,MH,GOA & GJ
  ABCD08684B,DL & PB
  ABCD08684E,BIHAR
  ABCD08684E,BLR, MYS & TMKR
  ABCD08684E,UTTAR PRADESH
  ABCD08684E,TAMIL NADU
  ABCD08684E,TELANGANA
  ABCD08684E,ORISSA
  ABCD08684E,MH,GOA & GJ
  ABCD08684E,DL & PB

 

 

table.pngConcatenate(Output).png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

@Greg_Deckler @Ashish_Mathur 

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@arvindarvind24 , crossjoin

 

new table = Crossjoin(Table1, Table2)

 

or

 

new table = addcolumns(Crossjoin(Table1, Table2) , "Concat", [Style No] & ", " & [Region]) 

View solution in original post

tamerj1
Super User
Super User

Hi @arvindarvind24 
Here is a sample file with the solution https://we.tl/t-IHBj2FTgwN

5.png

 

Concatenated Table = 
SELECTCOLUMNS (
    GENERATE (
        Table1,
        ADDCOLUMNS ( 
            Table2,
            "@Concatenate", Table1[Style No.] & "," & Table2[Region]
        )
    ),
    "Concatenate", [@Concatenate]
)

 

 

View solution in original post

9 REPLIES 9
tamerj1
Super User
Super User

Hi @arvindarvind24 
Here is a sample file with the solution https://we.tl/t-IHBj2FTgwN

5.png

 

Concatenated Table = 
SELECTCOLUMNS (
    GENERATE (
        Table1,
        ADDCOLUMNS ( 
            Table2,
            "@Concatenate", Table1[Style No.] & "," & Table2[Region]
        )
    ),
    "Concatenate", [@Concatenate]
)

 

 

Hi @tamerj1 ,

 

Thank you for ur Solution it's working fine and if we need to add a new data from table 3 to

Concatenate.

@arvindarvind24 
Sure Please provide more details

Please find the details below.

 

arvindarvind24_0-1656401792865.png

 

Style No.(Table1)Rank1(Table3-Measurestbl)Region(Table2)Concatenate(Output)
ABCD03700I1BIHARABCD03700I,1,BIHAR
ABCD062990BLR, MYS & TMKRABCD03700I,1,BLR, MYS & TMKR
ABCD084612UTTAR PRADESHABCD03700I,1,UTTAR PRADESH
ABCD08684B4TAMIL NADUABCD03700I,1,TAMIL NADU
ABCD08684E0TELANGANAABCD03700I,1,TELANGANA
ABCD0929715ORISSAABCD03700I,1,ORISSA
ABCD0930210MH,GOA & GJABCD03700I,1,MH,GOA & GJ
ABCD093511DL & PBABCD03700I,1,DL & PB
ABCD097781 ABCD06299,0,BIHAR
ABCD09838B0 ABCD06299,0,BLR, MYS & TMKR
   ABCD06299,0,UTTAR PRADESH
   ABCD06299,0,TAMIL NADU
   ABCD06299,0,TELANGANA
   ABCD06299,0,ORISSA
   ABCD06299,0,MH,GOA & GJ
   ABCD06299,0,DL & PB
   ABCD08461,2,BIHAR
   ABCD08461,2,BLR, MYS & TMKR
   ABCD08461,2,UTTAR PRADESH
   ABCD08461,2,TAMIL NADU
   ABCD08461,2,TELANGANA
   ABCD08461,2,ORISSA
   ABCD08461,2,MH,GOA & GJ
   ABCD08461,2,DL & PB
   ABCD08684B,4,BIHAR
   ABCD08684B,4,BLR, MYS & TMKR
   ABCD08684B,4,UTTAR PRADESH
   ABCD08684B,4,TAMIL NADU
   ABCD08684B,4,TELANGANA
   ABCD08684B,4,ORISSA
   ABCD08684B,4,MH,GOA & GJ
   ABCD08684B,4,DL & PB
   ABCD08684E,0,BIHAR
   ABCD08684E,0,BLR, MYS & TMKR
   ABCD08684E,0,UTTAR PRADESH
   ABCD08684E,0,TAMIL NADU
   ABCD08684E,0,TELANGANA
   ABCD08684E,0,ORISSA
   ABCD08684E,0,MH,GOA & GJ
   ABCD08684E,0,DL & PB
   ABCD09297,15,BIHAR
   ABCD09297,15,BLR, MYS & TMKR
   ABCD09297,15,UTTAR PRADESH
   ABCD09297,15,TAMIL NADU
   ABCD09297,15,TELANGANA
   ABCD09297,15,ORISSA
   ABCD09297,15,MH,GOA & GJ
   ABCD09297,15,DL & PB

@arvindarvind24 
The sample expected result does not clarify whether this is a crossjoin of the three tables or a merge between table1 and table3 then a crossjoj with table2. The complete crossjoin would be

Concatenated Table = 
SELECTCOLUMNS (
    GENERATE (
        Table1,
        GENERATE (
            Table2,
            ADDCOLUMNS ( 
                Table3,
                "@Concatenate", Table1[Style No.] & "," & Table3[Rank1] & "," & Table2[Region]
            )
        )
    ),
    "Concatenate", [@Concatenate]
)

@tamerj1 

 

If I want to use a cross join this will work?

 

oncatenatedTable =
SELECTCOLUMNS (
GENERATE (
ITEMMASTER,
GENERATE (
Measurestbl,
ADDCOLUMNS (Crossjoin(BaseStock),
"@Concatenate",
ITEMMASTER[STYLE_NUMBER] & "," & BaseStock[Region] & "," & Measurestbl[RANK11]
)
)
),
"Concatenate", [@Concatenate]
)

Hi @arvindarvind24 
Please use

Concatenated Table =
SELECTCOLUMNS (
    GENERATE (
        ITEMMASTER,
        GENERATE (
            BaseStock,
            ADDCOLUMNS (
                Measurestbl,
                "@Concatenate",
                    ITEMMASTER[Style No.] & "," & Measurestbl[Rank1] & "," & BaseStock[Region]
            )
        )
    ),
    "Concatenate", [@Concatenate]
)
Arul
Super User
Super User

@arvindarvind24 ,

you can also try to merge the tables in Power Query Editor as mentioned in the below community thread.

https://community.powerbi.com/t5/Desktop/Concatenate-String-Fields-From-Different-Tables/m-p/1425618 

 

Thanks,

Arul





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


LinkedIn


amitchandak
Super User
Super User

@arvindarvind24 , crossjoin

 

new table = Crossjoin(Table1, Table2)

 

or

 

new table = addcolumns(Crossjoin(Table1, Table2) , "Concat", [Style No] & ", " & [Region]) 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors