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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
BnicksTrin
Regular Visitor

Calculated column that filters by row level based on a column from another table

I need to create a calculated column that will return a value based on whether the primary key equlas a foreign key, i.e Opportunity(ID) - Contract(Opportunity ID), AND if a specific expression in another column meets an argument, Contract(RecordTypeName) = "Contract Requested". Any help?

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file whether it suits your requirement.

Jihwan_Kim_0-1712889456536.png

 

Jihwan_Kim_1-1712889725124.png

 

RecordTypeName CC =
VAR _opportunitycondition =
    COUNTROWS (
        FILTER ( RELATEDTABLE ( Opportunity ), Opportunity[condition] = "yes" )
    ) <> 0
VAR _reasoncondition =
    COUNTROWS (
        FILTER ( RELATEDTABLE ( Reason ), Reason[description] = "acceptable" )
    ) <> 0
RETURN
    IF ( _opportunitycondition && _reasoncondition, " Contract Requested" )

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


The Opportunity table and Contracts are the only two tables Im working with. The relationship is one to many based on the columns Opporunity(ID) and Contracts(Opporunity ID). In the Contracts table, there are columns that specify the type of record associated with an Opportunity ID: Contracts Renwal, Contracts Request, Pre-sales request, etc..I need to create a column in the Opportunity table that lists the record type for the Opportunity ID but identifies only opporutnity IDs that DO NOT have a contract request.  

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Top Kudoed Authors