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
vovcha
Frequent Visitor

Data model and matrix visual advice needed

Hi all,

I'm trying to figure out the most sustainable way to shape my data model to allow for a certain visual.

 

Here's the initial relationship scheme:

Data structure.PNG

Each product can have several components in the Bill of material (BOM). And each component has a certain characteristic.

This is very simplistic model, but it serves the purpose of showing the expected outcome.

 

And here are the visuals:

 

Matrices.PNG

 

 

What i'd like to have is the matrix 1 (sales per month per product with some extra characteristics in rows, that come from different tables, not only from products), but with all the products that have sales and not only the ones that have some records in the "BOMs" table. I.e. in this example i want to have the sales figures for "Bounty Dark" too. 

Moreover, if i decide to apply an external filter on "Component Group" = 1, i'd still like to see "Bounty dark" with it's sales. 

 

Another question: is there any way to avoid using bi-directional relationship between "Products" and "BOMs" and still be able to have the fields from "BOMs" in the rows section? 

 

I understand that there're workarounds such as making calculated columns in the "Products table". 

But i'd like to understand if something is possible with this data structure. And in general is there a best practice how to model this type of data.

 

Thank you in advance.

Vlad

 

 PS.

pbix file here: 

https://wetransfer.com/downloads/e26391684320ecb5682af1a1fe8c510720181001143257/8e96efcb2975e9ed5aaf...

2 REPLIES 2
v-frfei-msft
Community Support
Community Support

Hi @vovcha,

 

I think for the first one question, you can use matrix like this. Expanding the columns that you want.

 

Capture.PNG

 

For the second one, I think we can add calculated column by using LOOKUPVALUE function in the target table.

 

name = LOOKUPVALUE(Products[Name],Products[ProductID],BOMs[ProductID])

Regards,

Frank

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

Hi @v-frfei-msft,

 

Thanks a lot for your reply. 

I've learned that if you add the row subtotals to the matrix, the "bounty dark" sales start being visible, which is already good. 

However, i still have an issue if i apply an external filter (via slicer or page/visual filter) on the Component Group. If i ask to use only the component group = 1, the bounty dark product completely disappears from the matrix. 

 

I understand, that when i apply the filter on "Component group" column from "BOMs" table, this filter is propagated (through the bi-directional relationship) to the "Products" table and therefore "Bounty dark" is filtered out. 

Which makes me want to try to remove this bi-directional filtering even more. But then the visual stops working...

 

Solution with the calculated column indeed is an option (and i've written about it in my original post), but it's just not elegant :).

I'm wondering if there's any better solution without creating this calculated column.

 

The matrix logic should be:

Show me all the products with their sales, but also show me ComponentID and characteristic, but only for component group = 1, and if there's no component with such group, still show me the sales. 

 

This is the expected result, simulated manually in excel.

Expected.PNG

 

I realize that maybe i'm just asking too much, but who knows - maybe there's a way 🙂

 

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.