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
asjones
Helper IV
Helper IV

Creating a Relationship where the Fact row Must Between Two Values

I have to join two tables based on a few different attributes. I know I can do part of this by using Power Query and concatenating to fields. However the challenge is one of the dimensions varies based on a time frame in the format of a year/month.

 

Fact table

ClientDeptPeriodValue
AB10020190110
AB10020200220
ZY10020190530


Dimension Table

ClientDeptDivisionPeriod_FromPeriod_To
AB100Exec201901201904
AB100F&A201905202012
ZX100PRG201901202112

 

I can concatenate Client and Dept on both tables in Power Querty to do a Join but how do I handle if the Period column is in-between the Period_From and Period To in the Dimension table? I know how I would do this in a traditional SQL Join with a between statement but how do I create the relation in a Power BI Data Model?

 

Any ideas and thoughts?

 

thanks

Alan

 

 

2 REPLIES 2
amitchandak
Super User
Super User

@asjones 

One way is you create a new version of the table when you can all period from the between the range .

Refer how the new table is created using sheet and date for dates, you can do same for the period

https://www.dropbox.com/s/yuv64v0cneseghx/value%20Split%20between%20months%20start%20end%20date.pbix...

 

Refer to these SCD docs

https://powerpivotpro.com/2019/06/how-can-i-get-a-lookup-table-from-a-slowly-changing-dimension-scd/

https://www.zartis.com/scd-implementation-with-temporal-tables-in-power-bi/

@amitchandak 

 

Thanks for the response, that is an interesting solution. It seems like there should be a better way than creating entry for ever point between tow periods (dates). In my case the default Period_to is 209912. So going from say 201000 to 209912 is a huge nubmer of entries to dynamcially create in a table and deal with....

 

I do aprpecite the response, would loveto hear if anyone has other alternate ideas.

 

thanks

 

Alan

 

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.