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
Anonymous
Not applicable

Data Modelling in PBI for multiple conditional joins

Hi,

 

I am pretty new to PBI and data modelling. Instead of using SQL views i tried to join the tables directly in PBI and it is working perfectly. But now I have got the below scenario. In Merge I can select the column or multiple columns for joining but how can i define the below highlighted while merging my tables.


From

 dbo.IncidentDimvw I
 
 INNER JOIN dbo.WorkItemDimvw WI
 ON I.EntityDimKey = WI.EntityDimKey 

 LEFT OUTER JOIN 
 dbo.WorkItemCreatedByUserFactvw
 ON dbo.WorkItemCreatedByUserFactvw.WorkItemDimKey = WI.WorkItemDimKey
 AND WorkItemCreatedByUserFactvw.CreatedDate =
(
Select Max(CreatedDate) from WorkItemCreatedByUserFactvw where WorkItemDimKey = WI.WorkItemDimKey
)

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi, @Anonymous 

You could get by two merge steps as below:

First merge

Step1: 

In Merge function, merge WorkItemDimvw table and WorkItemCreatedByUserFactvw table

Step2:

Expand CreatedDate column and then use Group By to get Max(CreatedDate) for each WorkItemDimKey 

4.JPG

 

Second merge

Now merge WorkItemDimvw table and WorkItemCreatedByUserFactvw table by two conditional

dbo.WorkItemCreatedByUserFactvw.WorkItemDimKey = WI.WorkItemDimKey

and Max(CreatedDate) = WorkItemCreatedByUserFactvw.CreatedDate

 

Best Regards,

Lin

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-lili6-msft
Community Support
Community Support

hi, @Anonymous 

You could get by two merge steps as below:

First merge

Step1: 

In Merge function, merge WorkItemDimvw table and WorkItemCreatedByUserFactvw table

Step2:

Expand CreatedDate column and then use Group By to get Max(CreatedDate) for each WorkItemDimKey 

4.JPG

 

Second merge

Now merge WorkItemDimvw table and WorkItemCreatedByUserFactvw table by two conditional

dbo.WorkItemCreatedByUserFactvw.WorkItemDimKey = WI.WorkItemDimKey

and Max(CreatedDate) = WorkItemCreatedByUserFactvw.CreatedDate

 

Best Regards,

Lin

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.