The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
I am stumped trying to add a column from one table to another which have a many to many relationship.
The two tables are for a calendar visual - one table has date/time start times and the other has date/time end times for the calendar.
I tried creating an ID table with one to many relationships to both of these tables, but the calendar visual doesn't recognize the relationship between the times tables and won't work.
Ideally, I need one table with the start times end times. When I tried merge tables, it shows Table link. Is there a way to merge only the end times to the start time table in a way that is accurate by id and day name?
I've looked at relatedtable function but can't seem to get it to work the way I want.
Here is the data inside the two tables:
Start Time table:
End Time Table:
All of the columns in both tables after the start/end time are calculated columns to get the current date for the day of the week.
I tried linking the two tables on id and day name, but the calendar then shows multiple entries for every employee with every start and end time on the calendar (not correct data).
If anyone could assist with which DAX function I can use to achieve this, I'd be most grateful.
Solved! Go to Solution.
Hello - I figured out a solution for this which I'll post for anyone such as myself who is still in the learning stages of DAX. I'm sure it's not the most efficient way, but it worked for me.
I did a merge tables action which created a table with all of the data. In the new Merge table, I redid the calculations to gather the current weekday and created a date/time field for start and end dates. This created a table with a huge amount of duplicates where the start day name and end day names didn't match due to the many to many relationship.
So, I created a new column within the table to compare the two day names with "Yes" if they matched and "No" if they didn't. Then I just created a filter on my visual page for only those with a "Yes". This did the trick. Below are screenshots in case this helps anyone.
Merged table with many values from the start time and end time table;
Added column to merged table to check if the day names matched.
Finished calendar now shows one entry per employee per day.
Hello - I figured out a solution for this which I'll post for anyone such as myself who is still in the learning stages of DAX. I'm sure it's not the most efficient way, but it worked for me.
I did a merge tables action which created a table with all of the data. In the new Merge table, I redid the calculations to gather the current weekday and created a date/time field for start and end dates. This created a table with a huge amount of duplicates where the start day name and end day names didn't match due to the many to many relationship.
So, I created a new column within the table to compare the two day names with "Yes" if they matched and "No" if they didn't. Then I just created a filter on my visual page for only those with a "Yes". This did the trick. Below are screenshots in case this helps anyone.
Merged table with many values from the start time and end time table;
Added column to merged table to check if the day names matched.
Finished calendar now shows one entry per employee per day.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
113 | |
80 | |
77 | |
43 | |
39 |
User | Count |
---|---|
150 | |
117 | |
67 | |
64 | |
56 |