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
BlackBird
Frequent Visitor

Add table for each row in another table

I have two tables, Dates and Contracts:

Date
01/01/2020
01/02/2020
01/03/2020

 

Contracts
CT1
CT2
CT3

 

How can I join them like this?

DateContracts
01/01/2020CT1
01/01/2020CT2
01/01/2020CT3
01/02/2020CT1
01/02/2020CT2
01/02/2020CT3
01/03/2020CT1
01/03/2020CT2
01/03/2020CT3
3 ACCEPTED SOLUTIONS
Fowmy
Super User
Super User

@BlackBird 

Try Cross Join function

CROSSJOIN(
VALUES(TABLE1[DATE]_,
VALUES(TABLE2[CONTRACTS)
)

________________________

Did I answer your question? Mark this post as a solution, this will help others!.

I accept KUDOS 🙂

YouTube, LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

edhans
Super User
Super User

If you have a Dates and Contracts table as shown, in the Dates table, simply add a custom column in Power Query, then type =Contracts as your formula. It will initially look like this:

edhans_0-1595867827089.png

You an see the formula above just references the Contracts table. (if your table has a space in it, it would be ...each #"New Contracts")

Then just expand the Contracts column.

edhans_1-1595867860233.png

 

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

v-alq-msft
Community Support
Community Support

Hi, @BlackBird 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

 

You may create a calculated table as below.

Table = 
GENERATE(
    'Date',
    'Contracts'
)

 

Result:

a1.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.

 

View solution in original post

3 REPLIES 3
v-alq-msft
Community Support
Community Support

Hi, @BlackBird 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

 

You may create a calculated table as below.

Table = 
GENERATE(
    'Date',
    'Contracts'
)

 

Result:

a1.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.

 

edhans
Super User
Super User

If you have a Dates and Contracts table as shown, in the Dates table, simply add a custom column in Power Query, then type =Contracts as your formula. It will initially look like this:

edhans_0-1595867827089.png

You an see the formula above just references the Contracts table. (if your table has a space in it, it would be ...each #"New Contracts")

Then just expand the Contracts column.

edhans_1-1595867860233.png

 

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
Fowmy
Super User
Super User

@BlackBird 

Try Cross Join function

CROSSJOIN(
VALUES(TABLE1[DATE]_,
VALUES(TABLE2[CONTRACTS)
)

________________________

Did I answer your question? Mark this post as a solution, this will help others!.

I accept KUDOS 🙂

YouTube, LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

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