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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
HillHika
Regular Visitor

Comparing data in one column to another column in another table to return values to a new column

I have a list of customer ids in one column in a table and if they appear in another column in a separate table I want to return "CPT" and if they don't appear I want to return "NonCPT"

 

I tried the following, but it just brings up CPT for every row and if I change the 1 to a 0 it comes up with NonCPT for every entry. Getting rid of the number completely just brings back errors. NOTE: There are thousands of entries and only 123 of them should come up with CPT and the rest should be NonCPT.

 

Thoughts?

 

VAR RelatedRows =
    CALCULATE (
        COUNTROWS ( RELATEDTABLE('CPTs A-') ),
        CROSSFILTER ( 'Program Attendee Report'[ACID], 'CPTs A-'[CPT A-], Both )
    )
RETURN IF ( 1, "CPT", "Non CPT" )
1 ACCEPTED SOLUTION
SamInogic
Super User
Super User

Hi @HillHika 

You could try below DAX for this,

VAR RelatedRows =
CALCULATE (
COUNTROWS ( RELATEDTABLE('CPTs A-') ),
CROSSFILTER ( 'Program Attendee Report'[ACID], 'CPTs A-'[CPT A-], Both )
)
RETURN IF ( RelatedRows > 0, "CPT", "Non CPT" )

Thanks!

Inogic Professional Service Division

An expert technical extension for your techno-functional business needs

Power Platform/Dynamics 365 CRM

Drop an email at crm@inogic.com

Service:  http://www.inogic.com/services/ 

Power Platform/Dynamics 365 CRM Tips and Tricks:  http://www.inogic.com/blog/

Inogic Professional Services: Power Platform/Dynamics 365 CRM
An expert technical extension for your techno-functional business needs
Service: https://www.inogic.com/services/
Tips and Tricks: https://www.inogic.com/blog/

View solution in original post

2 REPLIES 2
SamInogic
Super User
Super User

Hi @HillHika 

You could try below DAX for this,

VAR RelatedRows =
CALCULATE (
COUNTROWS ( RELATEDTABLE('CPTs A-') ),
CROSSFILTER ( 'Program Attendee Report'[ACID], 'CPTs A-'[CPT A-], Both )
)
RETURN IF ( RelatedRows > 0, "CPT", "Non CPT" )

Thanks!

Inogic Professional Service Division

An expert technical extension for your techno-functional business needs

Power Platform/Dynamics 365 CRM

Drop an email at crm@inogic.com

Service:  http://www.inogic.com/services/ 

Power Platform/Dynamics 365 CRM Tips and Tricks:  http://www.inogic.com/blog/

Inogic Professional Services: Power Platform/Dynamics 365 CRM
An expert technical extension for your techno-functional business needs
Service: https://www.inogic.com/services/
Tips and Tricks: https://www.inogic.com/blog/

Thanks! It's counting them up correctly, which I don't understand because some numbers greater than zero aren't in both lists, and the numbers for comparison will continue to grow each week, but seems to be working. Much appreciated.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors