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
jscottNRG
Helper II
Helper II

data model relationships and calendar dimension

I've been puzzling over this problem for some hours now and hope someone will be able to help.  I'll try to simplify my data model to better illustrate what I'm trying to do.

I have three data tables: products (product IDs, type of product, color, and size), assemblies (product IDs and assembly date), and inspections (product ID and inspection date).  My report looks like this:

 report 1.png

 

This is my data model view, with dimension tables for date ("Work Date"), product color, and product size:


data model.png
 

By using slicers and my dimension tables, I can filter the tables on the report, for example by selecting "small" for product size.  This shows the products with size "small" and the assembly and inspection data for those products as expected:

 

report 2.png

 

I want to use the date slicer to choose a date range and show the assembly and inspection data for that range, along with all products that were either assembled or inspected in that range.  What I get is this - note that product_IDs 1, 3, and 4 were inspected on or after 1/6/2018 but it does not show up in the middle product table.  I only can see the products that were both assembled AND inspected in that date range, but that's not what I need.  How do I adjust my data model relationships so that I can see all products that were worked on in the date range I've chosen?  I believe it has something to do with my cross filter directions being Single vs. Both, but I can't seem to get the right configuration.

 

report 3.png 
 

Thanks in advance for any help.

J

1 ACCEPTED SOLUTION

Thanks all for your help.  Ultimately what I did to fix the issue was to create a bridge table:

 

1. Create columns with IDs for the "assemblies" and "inspections" tables (e.g. A1 for assembly number 1, I2 for inspection number 2, etc.)

2. Make a new query as a reference of "assemblies", append "inspections"

3. Add relationships between the bridge table and Work Date, inspections, assemblies and products.

 

This way, when I make a slicer selection in my Work Date (calendar) table, the bridge table shows both assemblies and inspections that occurred in the time range selected.  And most importantly, the middle "products" table is filtered such that a product is shown if it either has an assembly or an inspection in the date range, whereas the previous setup only showed a product if it had an assembly and an inspection in the date range.

View solution in original post

5 REPLIES 5
v-danhe-msft
Employee
Employee

Hi @jscottNRG,

Could you have tried edit below relationship from simple to both?

1.PNG

 

Regards,

Daniel He

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

Thanks all for your help.  Ultimately what I did to fix the issue was to create a bridge table:

 

1. Create columns with IDs for the "assemblies" and "inspections" tables (e.g. A1 for assembly number 1, I2 for inspection number 2, etc.)

2. Make a new query as a reference of "assemblies", append "inspections"

3. Add relationships between the bridge table and Work Date, inspections, assemblies and products.

 

This way, when I make a slicer selection in my Work Date (calendar) table, the bridge table shows both assemblies and inspections that occurred in the time range selected.  And most importantly, the middle "products" table is filtered such that a product is shown if it either has an assembly or an inspection in the date range, whereas the previous setup only showed a product if it had an assembly and an inspection in the date range.

MFelix
Super User
Super User

Hi @jscottNRG,

 

Didn't made a copy of your model but I saw that in the relationship between the tables Assemblies and Products you have bidirectionalaty on try to change it to single and check if it works.

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Thanks for the suggestion @MFelix.  I'm afraid that this won't do what I need, because I need assemblies and inspections to be filtered by changes in the color and size slicers.  At the same time I also need selections made in the date slicer to filter the products table.  So it seems like I'd need both of the relationships - between assemblies and products and between inspections and products - to be bidirectional, but when I tried it Power BI did not allow that.

Can you share a sample of the report?

If any sensitive data try to make a mockup or send the link through private message.

Regards,
MFelix

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



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.