Forum Discussion
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?
- 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-cartesian-product-with-power-query?forum=powerquery
4 Replies
- Greg_DecklerCommunity Champion
- BirdjoResolver IIThank you, but I need it in Power Query.
- QuaxdachsRegular VisitorI 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-cartesian-product-with-power-query?forum=powerquery- BirdjoResolver II
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.