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
byr10112
Employee
Employee

Calculated column based on another table with conditions

I have two tables. One table has the list of completed deals and the other table has the list of accounts. I'm trying to add a column to the accounts table that shows whether an account has a completed deal. The completed deals table has multiple occurences for each account ID. Below is a sample of tables:

 

Completed Deals

Account IDDeal NameCompleted
1001xxx1
1001xyz1
1001xyy0
1002yyz0
1002aad1

 

Accounts

Account ID
1001
1002
1003

 

Below is what I need the Accounts table to look like

 

Accounts

Account IDCompleted Deal
1001Completed Deal
1002Completed Deal
1003No Completed Deals
1004No Completed Deals

 

How can I achieve this? 

1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
Community Support

Hi @byr10112 ,

 

Try formula like below:

Result =
VAR row_ =
    CALCULATE (
        COUNTROWS ( 'Completed Deals' ),
        ALL ( 'Completed Deals'[Account ID] )
    )
RETURN
    IF ( row_ > 0, "Completed Deal", "No Completed Deals" )

vhenrykmstf_0-1664245705417.png

If the problem is still not resolved, please point out the errors and give further examples to describe your needs so that I can answer them for you as soon as possible.


Best Regards,
Henry


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-henryk-mstf
Community Support
Community Support

Hi @byr10112 ,

 

Try formula like below:

Result =
VAR row_ =
    CALCULATE (
        COUNTROWS ( 'Completed Deals' ),
        ALL ( 'Completed Deals'[Account ID] )
    )
RETURN
    IF ( row_ > 0, "Completed Deal", "No Completed Deals" )

vhenrykmstf_0-1664245705417.png

If the problem is still not resolved, please point out the errors and give further examples to describe your needs so that I can answer them for you as soon as possible.


Best Regards,
Henry


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.