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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
Anonymous
Not applicable

How to multiply Table with table in Power BI

Hello,

 

Can you explain how we can multiply each row of Table 2 with Table 1? So we can achieve table 3? 

 

Ahmet_Oz_0-1597156115446.png

 

Thank you

 

Regards

 

Ahmet

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Ahmet_Oz , Crossjoin

Cross-joint(Table1, Table2)

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

2 REPLIES 2
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

You may achieve your requirement in 'Query Editor' or Power BI Desktop. I created data to reproduce your scenario. The pbix file is attached in the end.

Table1:

c1.png

 

Table2:

c2.png

 

In 'Query Editor', you may duplicate query 'Table1', remove column 'Surname', add a custom column and then expand the column with lists.

c3.png

Here are codes in 'Advanced Editor'.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCkgsyixW0lFyrFKK1YlW8srPyAPy/CG84JLUtEQQ3xPIjwUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Name = _t, Surname = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Surname", type text}}),
    #"Removed Columns" = Table.RemoveColumns(#"Changed Type",{"Surname"}),
    Custom1 = Table.AddColumn(#"Removed Columns","Title",each Table2[Title]),
    #"Expanded Title" = Table.ExpandListColumn(Custom1, "Title")
in
    #"Expanded Title"

 

Result:

c4.png

 

In Power BI Desktop, you may create a calculated table as below.

Table = 
CROSSJOIN(
   DISTINCT('Table2'[Title]),
   DISTINCT(Table1[Name])
)

 

Result:

c5.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Ahmet_Oz , Crossjoin

Cross-joint(Table1, Table2)

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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