cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Birdjo Member
Member

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

Accepted Solutions
Quaxdachs Frequent Visitor
Frequent Visitor

Re: Create table with every employee for every date

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...
4 REPLIES 4
Super User
Super User

Re: Create table with every employee for every date

Have a look at the GENERATE function:

 

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

 

 


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

Proud to be a Datanaut!


Birdjo Member
Member

Re: Create table with every employee for every date

Thank you, but I need it in Power Query.
Quaxdachs Frequent Visitor
Frequent Visitor

Re: Create table with every employee for every date

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...
Birdjo Member
Member

Re: Create table with every employee for every date

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.

Helpful resources

Announcements
Back to School Contest

Back to School Contest

Engage and empower students with Power BI!

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Summit Australia 2019

Summit Australia 2019

Travel to Melbourne and network with thousands of peers!

PBI Community Highlights

PBI Community Highlights

Check out what's new in the Power BI Community!

Top Ideas
Users Online
Currently online: 28 members 670 guests
Please welcome our newest community members: