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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
Anonymous
Not applicable

DAX statement does not see the table

Hi Guys ! 
I have got a simple problem, but for some reason under DAX it is not so simple.


I have got two tables:
i); all_ip_addresses,  ii); chosen_ip_addresses

ii); Chosen ip addresses contain two columns, the addresses and description for each.

In both cases I operate with String.

I was going to create a simple column with IF statement that will check if chosen ip's are contained within some of those in all_ip_addresses. If they are, print the description from ii); chosen_ip_addresses, else print ip address from all_ip_addresses. 
When I am trying to do that, DAX does not seem to see my chosen_ip_addresses table at all. 
The relationship between tables seem to be created correctly as when applying data to a simple table in visualization it seems to work.


Unfotunatelly the data is sensitive and I can not pass it over. I hope that I clearly explained it.
 

So the column would end up like :

 

Wanted_Output
__________________

1.1.1.1

2.2.2.2

chat_service

2.3.4.5

Antivirus

 

 

 

Thank you in Advance ! 

Kind Regards,
Bart

 

2 ACCEPTED SOLUTIONS

Hi @Anonymous 

 

Try columns like below, this will check if there was any transaction in chosen_ip_addresses table related ( using active relationship ) to the table the column is in. 

 

Column = 
CALCULATE(
    COUNTROWS( chosen_ip_addresses ) > 0 
)

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

 

View solution in original post

Anonymous
Not applicable

Ok Mariusz ! 

I think I have figured it out.

InfoColumn = if(CALCULATE(COUNTROWS(chosen_ip_addresses) > 0), RELATED(chosen_ip_addresses[Description]) , all_ip_addresses[Ip])

This has solved my problem ! 
Thank you for your time !! 

Kind Regards,
Bart

View solution in original post

7 REPLIES 7
Greg_Deckler
Super User
Super User

If what @Mariusz says doesn't work you might try LOOKUPVALUE.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

Use RELATED or RELATEDTABLE functions when referring to another table.

 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Anonymous
Not applicable

InfoColumn= IF(CONTAINS(RELATEDTABLE(chosen_ip_addresses),chosen_ip_addresses[Ip], all_ip_addresses[Ip]), chosen_ip_address[description], all_ip_addresses[Ip])


I have tried that just before texting here, maybe I am just aproaching it incorrectly.
Just at the end when I am trying to get the description, the DAX does not see that table/column, and I can not get that value.
Does my example at the top makes some sence ? 

I was kind of based from this :

Column =
IF (
    CONTAINS ( RELATEDTABLE ( Table2 ), Table2[Country of Origin], "CHILE" ),
    "CHILE",
    "OTHER COUNTRIES"
)



Thank you for you time and help.

Kind Regards,
Bart

Hi @Anonymous 

 

Try columns like below, this will check if there was any transaction in chosen_ip_addresses table related ( using active relationship ) to the table the column is in. 

 

Column = 
CALCULATE(
    COUNTROWS( chosen_ip_addresses ) > 0 
)

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

 

Anonymous
Not applicable

Hey Mariusz ! 

That seems to be working, I am getting a list of chosen_ip_addresses when its true.
Might be a "stupid" question but, how would i get the description from chosen_ip_addresses to be visible in place of TRUE and the  ip address from all_ip_addresses in place of FALSE ? 
I really appreciate your help,

Kind Regards,
Bart

Hi @Anonymous 

 

Can you send a screenshot of the relationship between these two tables?

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn


 

Anonymous
Not applicable

Ok Mariusz ! 

I think I have figured it out.

InfoColumn = if(CALCULATE(COUNTROWS(chosen_ip_addresses) > 0), RELATED(chosen_ip_addresses[Description]) , all_ip_addresses[Ip])

This has solved my problem ! 
Thank you for your time !! 

Kind Regards,
Bart

Helpful resources

Announcements
May PBI 25 Carousel

Power BI Monthly Update - May 2025

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

May 2025 Monthly Update

Fabric Community Update - May 2025

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