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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Kristofferaabo
Helper IV
Helper IV

Return 'Yes' or 'No'/BLANK if value exists in related table

Hi,

 

I have two tables connected via 'project code'.

 

"Table A" and "Table B" (connected via project code)

 

I have made a simple table in my canvas with columns only from 'Table A'. Can I somehow make a calculated formula returning a Yes or a blank if the project code also appear in table B?

Thanks

Kristoffer

 

Project code:   date              sales       In table B?

Project 1          17Jun             4546         Yes

Project 2          24Jan            34646         Blank



 

 

1 ACCEPTED SOLUTION
Phil_Seamark
Employee
Employee

HI @Kristofferaabo

 

You could try the following calculated measure.

 

In table B? = 
VAR MyProjectCode = MIN('Table A'[Project Code])
RETURN IF(
        COUNTX(
            FILTER(
                'Table B',
                'Table B'[Product Code] = MyProjectCode
                ),
                'Table B'[Product Code])>0,
                "Yes"
                )

image.png

 


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

7 REPLIES 7
brunozanoelo
Helper V
Helper V

i have the same issue BUT I need to return one value from the WORKING table if DAX can´t find one value in the related table.

YesNoIfFoundInOtherTable =
IF(
ISBLANK(
LOOKUPVALUE('Related Table'[Key], 'Related Table'[Key], WorkingTable[Key])
),
WorkingTable[DESCRIPTION], 'Related Table'[DESCRIPTION]
)

How it is possible?
FayeB1901
Helper I
Helper I

Hi @Phil_Seamark - This works great as a measure. But ideally I this to function as a column. I'm trying to create a matrix like this (where values represent revenue split within a category). Your measure is the apparatus/no apparatus piece - where I'm checking to see if the  unique identifier in Table A, is in Table B. I need to show this as column critera, not in values.

FayeB1901_1-1628727007565.png

How can I edit the measure to apply as a column? 

Cheers, Faye

Howdy, this solution worked for me:

 

YesNoIfFoundInOtherTable =
IF(
ISBLANK(
LOOKUPVALUE('Related Table'[Key], 'Related Table'[Key], WorkingTable[Key])
),
"No", "Yes"
)
Phil_Seamark
Employee
Employee

HI @Kristofferaabo

 

You could try the following calculated measure.

 

In table B? = 
VAR MyProjectCode = MIN('Table A'[Project Code])
RETURN IF(
        COUNTX(
            FILTER(
                'Table B',
                'Table B'[Product Code] = MyProjectCode
                ),
                'Table B'[Product Code])>0,
                "Yes"
                )

image.png

 


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

This solution worked perfectly for me. Thanks! 

Anonymous
Not applicable

This is brilliant. Thanks @Phil_Seamark  for the solution and @Kristofferaabo  for asking the question. 

Works great! exactly! thanks so much

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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