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 September 15. Request your voucher.

Reply
anandmitta
Helper I
Helper I

Power Bi Dax measure to send data to different table visuals based on data from data source

I have 2 tables from a data source

Table A(Data Source)

Name Age
A10
B12
C13
D14
E15
F16
G17

Table B(Data Source)

Name DOB
A10-MAR
C20-APR
D31-MAY
G26-DEC

I have 2 table Visuals in power bi

  • Table 1(Visual)
  • Table 2(Visual)

I have go through all the Name fields in Table A(Data source) and check if that Name is in Table B(Data Source)

If the name is present in Table B (Data Source) send that name to Table 1 (Visual) else send that to Table 2 (Visual)

I'm finding difficulty in creating DAX measure to make this work in power bi.

1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

Here you go.  I put them in the same table visual with the TableA[Name] column, but you can duplicate the table and use one measure in each.

 

mahoneypat_0-1626016132129.png

 

Is In Table B =
VAR Brows =
    CALCULATE ( COUNTROWS ( TableB ), TableB[Name] IN VALUES ( TableA[Name] ) )
RETURN
    IF ( Brows > 0"Y" )


Is Not In Table B =
VAR Brows =
    CALCULATE ( COUNTROWS ( TableB ), TableB[Name] IN VALUES ( TableA[Name] ) )
RETURN
    IF ( ISBLANK(Brows)"Y" )

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

3 REPLIES 3
mahoneypat
Microsoft Employee
Microsoft Employee

Here you go.  I put them in the same table visual with the TableA[Name] column, but you can duplicate the table and use one measure in each.

 

mahoneypat_0-1626016132129.png

 

Is In Table B =
VAR Brows =
    CALCULATE ( COUNTROWS ( TableB ), TableB[Name] IN VALUES ( TableA[Name] ) )
RETURN
    IF ( Brows > 0"Y" )


Is Not In Table B =
VAR Brows =
    CALCULATE ( COUNTROWS ( TableB ), TableB[Name] IN VALUES ( TableA[Name] ) )
RETURN
    IF ( ISBLANK(Brows)"Y" )

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


mahoneypat
Microsoft Employee
Microsoft Employee

This is doable with two DAX measures, but why not just merge the two tables.  Where a name exists in B, you'll have data in those columns expanded from B, and where it doesn't you won't.  You can then make two table visuals and use a visual filter to either show the blank values or everything but the blank values.

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Thanks for that Pat, but the data comes from 2 different sources and I'm loading the data using DirectQuery rather than Import. When trying to merge those tables I get the error "This step result in a query that is not supported in DirectQuery mode". So I thought using DAX would be appropriate solution for this and was facing difficulty in creating those DAX measures.

 

If possible could you please help me with those DAX measures?

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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