cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
NathanPzi
Regular Visitor

DAX Relation between DirectQuery and Import

Hello,
I have a report that contains multiple tables, one is in 'Import' mode, and the other is in 'DirectQuery' mode and is linked to another report.
Import: Grille tarifaire[Moyenne]
DirectQuery: Affaire[TJM Vendu]
I'm trying to create a calculated column with this function: Flag TJM PFSA = if(RELATED('Grille tarifaire'[Moyenne]) = BLANK(), 5, if(RELATED('Grille tarifaire'[Moyenne]) >= Affaire[TJM Vendu],1,10))

But Power BI is giving me this error: The column 'Grille tarifaire[Moyenne]' either doesn't exist or doesn't have a relationship with any table available in the current context.

However, I have established a relationship between the two tables using a reference, and the relationship is active with the correct cardinality.
And when creating the column using "RELATED", Grille tarifaire shows up as a suggestion.

If anyone has any tips or a solution to my problem, I would greatly appreciate it.

Thank you 🙂

1 REPLY 1
v-yanjiang-msft
Community Support
Community Support

Hi @NathanPzi ,

If the relationship is one to many, RELATED function can only be used in the many side table. In other words, 'Grille tarifaire' should be the one side in the relationship.

If not, you can use this formula to reference:

MAXX ( FILTER ( 'table2', 'table2'[column1] = 'table1'[column1] ), [column2] )

 

Best regards,

Community Support Team_yanjiang

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

Helpful resources

Announcements
Join Arun Ulag at MPPC23

Join Arun Ulag at MPPC23

Get a sneak peek into this year's Power Platform Conference Keynote.

PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Top Solution Authors
Top Kudoed Authors