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
snayff
Regular Visitor

DAX to Get Sales From Related Table - Relationship Not Found

The Problem

I am trying to create a calculated column that tells me how much has been sold for each row (i.e. each ID) in the `dimBroker` table where:

1. The sale took place in the last year

2. The Broker Status is SP

3. The sale has completed

 

I am then looking to check if the amount sold is greater than the target. 

 

Background

`dimBroker[ID]` has a 1-Many relationship with `factLoanData[BrokerID]` .

`dimStatus[ID]` has a 1-Many relationship with `factLoanData[StatusID]`.

 

Current Progress

snayff_0-1661424809386.png

Even though there is a direct link I am getting the error stating there is no relationship. Perhaps I am missing something obvious! 

 

Any help would be appreciated

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

You need to move the RELATED(dimBroker[ID]) into a variable. There is no row context inside CALCULATE.

View solution in original post

3 REPLIES 3
snayff
Regular Visitor

@johnt75 that did it, thank you very much!

ToddChitt
Super User
Super User

Sounds like you are over-thinking it.

All those requirements you state for the Sales are dimensions of the Sale. Forget about them for getting started. 

Sales = SUM ( factLoanData[AdjustedGrossLoan] )

And where are you putting this measure? If in the Loan Data table, fine. That table can be 'sliced' by your dimension tables of Date, Broker, and Status.

Next, do you have a Goal table that is also joined to those three dimensions? If so, you can have this:

Goal = SUM ( factLoanGoal[LoanGoal] )

Now create a measure for comparing the two:

Meets Goal = IF ( [Sales] > [Goal], "True", False" )

 

Take the dimensionality out of it. Start with the above. Once you have that, start slicing by varioius dimensions and see what happens.




Did I answer your question? If so, mark my post as a solution. Also consider helping someone else in the forums!

Proud to be a Super User!





johnt75
Super User
Super User

You need to move the RELATED(dimBroker[ID]) into a variable. There is no row context inside CALCULATE.

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.