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
Unicorn_Tech
Resolver I
Resolver I

Countif equivalent in Power BI

Hello.  I have a column in TableA that is a concatenate of two fields:  ProductID and CountryID.  In TableB, I have another column that is also a concatenate of ProductID and CountryID.  I am looking for a formula that would tell me if a record in this column in TableA, has an equivalent to a record in the column in TableB.  In excel I would use a Countif, 0 meaning no record, and 1 (or more) if there were more records. And then I would probably nest that with an IF function so that it could just be true or false.

How can I sort this in DAX?

Thank you!

1 ACCEPTED SOLUTION
Unicorn_Tech
Resolver I
Resolver I

I ended up doing this, but I feel it's a bit convulted.  I couldn't get the above solutions to work.

Match record = if(ISBLANK(lookupvalue(TableB[check], TableB[check], TableA[Check])),"No record", "Record")

View solution in original post

3 REPLIES 3
Unicorn_Tech
Resolver I
Resolver I

I ended up doing this, but I feel it's a bit convulted.  I couldn't get the above solutions to work.

Match record = if(ISBLANK(lookupvalue(TableB[check], TableB[check], TableA[Check])),"No record", "Record")
AlB
Super User
Super User

Hi @Unicorn_Tech 

An example based on sample data with the expected result would help understanding the requirement. Try this:

1. Place TableA[Column1] in a table visual

2. Create this measure and palce it in the visual:

Measure =
IF (
    CALCULATE (
        COUNT ( TableB[Column1] ),
        TREATAS ( SELECTEDVALUE ( TableA[Column1] ), TableB[Column1] )
    ) > 0,
    TRUE (),
    FALSE ()
)

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

 

 

amitchandak
Super User
Super User

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.