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
Birdjo
Resolver II
Resolver II

Create table with every employee for every date

Hello,

I would like to create a calendar table where for every single date there is a row for every employee ID. 

I already have a calendar table and a separate Employees table in a SQL database. I would like next to the column Calendar[Date] to have a column Calendar[EmployeeID]

 

Would you like to tell me how to do that?

 

 

1 ACCEPTED SOLUTION
Quaxdachs
Regular Visitor

I can't imagine any scenario for such a table. Separate tables have many advantages. Why do you need auch a table and did you overthink your model?
Anyways: combining each record of one table with each record of another table is a Cartesian product. You will finde some solutions with this search term in google, e.g. https://social.technet.microsoft.com/Forums/en-US/8fbf5474-8b83-4a3a-8a52-b538f8499eb8/create-a-cart...

View solution in original post

4 REPLIES 4
Quaxdachs
Regular Visitor

I can't imagine any scenario for such a table. Separate tables have many advantages. Why do you need auch a table and did you overthink your model?
Anyways: combining each record of one table with each record of another table is a Cartesian product. You will finde some solutions with this search term in google, e.g. https://social.technet.microsoft.com/Forums/en-US/8fbf5474-8b83-4a3a-8a52-b538f8499eb8/create-a-cart...

I am making for employee attendance where I need every date by every employee in order to make a relationship with the clock ins and clock outs.

 

What I did is to make a simple query in SQL.
Another way that I was told in Global Power BI User Group @ Facebook was to add a column with value of "1" in each table and merge them. Very simple and clean. 

 

Thank you, I will accept your recommendation as a solution without trying. I believe it works.

Greg_Deckler
Super User
Super User

Have a look at the GENERATE function:

 

https://msdn.microsoft.com/en-us/library/gg492196.aspx

 

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thank you, but I need it in Power Query.

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.