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
김기만
Frequent Visitor

DAX Join Error When Using Related Tables

We are going to attempt a JOIN between the two tables below in Power BI.
The goal of calculation is to be able to check by time zone in the view table as the time zone appropriate for each type through JOIN between the two tables.

 

'DIM_SCHEDULE' table example
[TYPE] [START] [END] [Status] → (Work status)
Type1 | 09:00 | 10:30 |True
Type1 | 10:30 | 10:40 | False
Type1 | 10:40 | 12:00 | True
Type1 | 12:00 | 13:00 | False
Type1 | 13:00 | 15:00 | True
Type2 | 09:00 | 10:30 |True
Type2 | 10:30 | 10:40 | False
Type2 | 10:40 | 12:00 | True
Type2 | 12:00 | 13:00 | False
Type2 | 13:00 | 15:00 | False
Type3 | 00:00 | 00:00 | False


'VIEW_SOMEONE' table example
[ProdNum] [Date] [WType] [INPUT] [OUTPUT]
Product_1 | 23-01-02 | Type1 | (DateTime) | (DateTime)
Product_1 | 23-01-03 | Type1 | (DateTime) | (DateTime)
Product_2 | 23-01-03 | Type1 | (DateTime) | (DateTime)
Product_2 | 23-01-04 | Type1 | (DateTime) | (DateTime)
Product_3 | 23-01-03 | Type2 | (DateTime) | (DateTime)
Product_3 | 23-01-04 | Type1 | (DateTime) | (DateTime)
Product_3 | 23-01-01 | Type2 | (DateTime) | (DateTime)

 

There are two tables like above.

 

DIM's Type and VIEW's WType are the same text. The two tables are connected in a many-to-many relationship with each type. After the matching rows, I would like to increase the rows and columns of data for each time zone of the DIM corresponding to each type.

However, both the NATURALLEFTOUTERJOIN and NATURALINNERJOIN functions do not work. I get an error saying a common join column is required.
This does not work whether the table names of the two connected columns are the same or not. What is the cause of this problem and is there a solution?

2 REPLIES 2
amitchandak
Super User
Super User

@김기만 , You can use expression function for that

 

New column in Table 2

Maxx(filter(Table1, Table1[Type] = Table2[Wtype] && Timevalue(Table2[DateTime]) > =Table1[Start] &&  Timevalue(Table2[DateTime]) < =Table1[End] ) , [Status]) 

Thanks for your answer.

I tried applying your answer, but I only get an Error.

Like the first table, even in one type, data exists in different columns for each time zone. Therefore, it is necessary to be able to express it by adding a table for each date of the day, and an action such as Join is needed to increase the column while joining the table and increase the rows that meet the conditions enough to express Table2 in detail by time.

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.