Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
JBDelvaux
Helper I
Helper I

Related in composite model

Greetings,

I have a two tables, one that is imported(Products), the other is DirectQuery(Lignes_A). There is a many to one relationship (Lignes_A being many and Products being one). I'm trying to use the related function to get the value "family" that is in Products. Related even recognize the products table as a related table, but once I valid the Dax, it says it isn't possible because these tables arent related.

From what I could gather, this is basically an issue that's been going around for a year now. How can I go around this issue?

Here's the Dax query I've come up with (which was working while I still had everything on import, but due to size is not a viable option):

 

SpentDuringRebate = SUMX(FILTER(LIGNES_A,
RELATED(PIEDS_A[ID_FOU]) = 'reporting SupplierRebatesRules'[SupplierId] &&
('reporting SupplierRebatesRules'[ExcludedFamille] = BLANK() || 'reporting SupplierRebatesRules'[ExcludedFamille] <> RELATED(Products[FAMILY])) &&
('reporting SupplierRebatesRules'[ExcludedRayon] = BLANK() || 'reporting SupplierRebatesRules'[ExcludedRayon] = RELATED(Products[RAYON])) &&
('reporting SupplierRebatesRules'[RestrictedFamille] = BLANK() || 'reporting SupplierRebatesRules'[ExcludedRayon] <> RELATED(Products[FAMILY])) &&
('reporting SupplierRebatesRules'[RestrictedRayon] = BLANK() || 'reporting SupplierRebatesRules'[RestrictedRayon] = RELATED(Products[RAYON])) &&
RELATED(PIEDS_A[DATE]) >= 'reporting SupplierRebatesRules'[DateStart] &&
RELATED(PIEDS_A[DATE]) < 'reporting SupplierRebatesRules'[DateEnd]),
[TOT_NET_HT])

 

And here's an image of my relationships. I highlighted the foreign keys. Does anyone know what I can use instead of Related, as it is not working?

 

 

1 REPLY 1
Stachu
Community Champion
Community Champion

it seems there are at least 4 tables used here:

'LIGNES_A'

'PIEDS_A'

'reporting SupplierRebatesRules'

'Products'

plus whatever table is being used in [TOT_NET_HT]

 

Can you add sample tables (in format that can be copied to PowerBI) from your model with anonymised data? Like this (just copy and paste into the post window).

Column1 Column2
A 1
B 2.5

Maybe there is a way to achieve the same result without using RELATED, but in order to see if it's possible I would need to see the data



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.