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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Can someone please explain this DAX measure?

I'm totally new to power bi and I'm using this measure to compare two tables. It worked on the first two tables but when I tried it on another tables then for some reason it was not working so I figured that maybe I should try to really understand how the measure works so I can properly troubleshoot why it is not working on those tables.

 

Is Contained in Table 2 =
IF (
    CONTAINS (
        Table2,
        Table2[Code], MAX ( Table1[Code] ),
        Table2[Code2], MAX ( Table1[Code2] ),
        Table2[Date], MAX ( Table1[Date] )
    ),
    1,
    0
)

Thank you very much! 

2 ACCEPTED SOLUTIONS
AlexisOlson
Super User
Super User

This looks at the maximal Code, Code2, and Date values of Table1 within the current filter context and checks if there is a row in Table2 that matches all of these values. (If there isn't any local filter context, it's the max over the entire Table1.)

 

This documentation for CONTAINS might help a bit:

https://dax.guide/contains/

View solution in original post

CONTAINS returns True or False. IF turns this into 1 or 0, respectively.

IF ( <LogicalTest>, <ResultIfTrue>, <ResultIfFalse> )

View solution in original post

3 REPLIES 3
AlexisOlson
Super User
Super User

This looks at the maximal Code, Code2, and Date values of Table1 within the current filter context and checks if there is a row in Table2 that matches all of these values. (If there isn't any local filter context, it's the max over the entire Table1.)

 

This documentation for CONTAINS might help a bit:

https://dax.guide/contains/

Anonymous
Not applicable

What about the 1 and 0 at the end though?

CONTAINS returns True or False. IF turns this into 1 or 0, respectively.

IF ( <LogicalTest>, <ResultIfTrue>, <ResultIfFalse> )

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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