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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
MarcUrdang
Post Patron
Post Patron

Related function

Hello

I am trying to write a calculation where I compare various data and then if true return a result. One of these fields comes from another table and when I use the Related function it returns an error saying that either the filed doesn't exist or there is no relationship bestween the tables (which there is).

 

Any guidance would be appreciated.

 

The calc is as follows:

 

Client Order Number =
IF([Charge Code/ GL] = "DRB","Drawback",
             IF('Chg Code Master'[Charge Code/ GL] <> "DRB" && RELATED('Invoice Line'[ClientLineOrderNo]<>BLANK(),                                               RELATED('Invoice Line'[ClientLineOrderNo],"PO Needed"))))
1 ACCEPTED SOLUTION
vivran22
Community Champion
Community Champion

Hello @MarcUrdang 

 

Can you share the sample pbix file or snapshot of the model view?

 

Cheers!
Vivek

https://www.vivran.in/
Connect on LinkedIn

View solution in original post

9 REPLIES 9
v-frfei-msft
Community Support
Community Support

Hi @MarcUrdang ,

 

Kindly share your sample data and excepted result to me, You can just copy and paste your content here directly. 

 

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

@MarcUrdang 

First, both tables should be related. Second I see two related. I think you have to use it only on one side. Side from where you are trying to get data.

There is detailed explanation on https://databear.com/dax-related-table-functions/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi Amit .. yes they are both related .. and the tables are many to many relationship .. so I guess then i cannot do this?

@MarcUrdang , need sample to test. I think in your formula, you used related on both sides. try using only on one side.

 

Some time I also do this

Get from Table 2 in table 1

New Column = maxx(filter(table2,table2[Col1]= table1[col1] && table2[Col2]= table1[col2] ),table2[required_col])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi Vivek .. thx so much .. it is very close but not quite correct as now it brings back just one of the PO Numbers against every line nad not the actual PO number for that line .. can I mail you the workbook? You will then see what I mean. Or perhaps I can show you in Teams? I can set up a call?

thanks
Marc

Sorry Amit .. I put the wrong name in 😞 

@ImkeF , @Greg_Deckler , Can you help.

 

These tables have many to many join on the job no. And one on the table has line no. In visual he wants to bring line no from another table.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
vivran22
Community Champion
Community Champion

Hello @MarcUrdang 

 

Can you share the sample pbix file or snapshot of the model view?

 

Cheers!
Vivek

https://www.vivran.in/
Connect on LinkedIn

Hi Vivek .. thank you so much for your quick reply .. our company doesn't allow us to post but I am able to email the .pbix if you don't mind that? If you can supply an email address I will send immediately.

thanks
Marc

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Top Solution Authors