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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
MarkKemeny
New Member

RELATED () function error

Hi Guys,
I have a problem with the RELATED() funcion in dax.
I have a simple dimension and fact table where I have to compare date values in the fact table with the values in the dimension table:
CALCULATE(COUNTROWS('fct_Overview_Status_Phase_1-2-3_Promotion'), 'fct_Overview_Status_Phase_1-2-3_Promotion'[Date.1]<RELATED(dim_Deadlines[Deadline])).
It gives me the error that "The column 'dim_Deadlines[Deadline]' either doesn't exist or doesn't have a relationship to any table available in the current context."

The two tables are connected with a 1 to many relationship so I dont understand what is the problem.
When I create a conditional column in the fact table using the RELATED() function it works fine, but when I am using that inside a DAX measure it gives me this error.
Thanks,

Mark

2 ACCEPTED SOLUTIONS
johnt75
Super User
Super User

At the point where you are using RELATED no row context exists, so it cannot traverse the relationship. I think you want something like

My Measure =
VAR MaxDate =
    MAX ( dim_Deadlines[Deadline] )
RETURN
    CALCULATE (
        COUNTROWS ( 'fct_Overview_Status_Phase_1-2-3_Promotion' ),
        'fct_Overview_Status_Phase_1-2-3_Promotion'[Date.1] < MaxDate
    )

As long as some column from your dimension table is in the visual this should work.

View solution in original post

v-zhangti
Community Support
Community Support

Hi, @MarkKemeny 

 

You can try the following methods.
Sample data:

One to many

vzhangti_0-1676254785263.png

vzhangti_2-1676254814170.png

Measure = 
CALCULATE ( COUNTROWS ( 'fct_Overview_Status_Phase_1-2-3_Promotion' ),
    FILTER ( ALL ( 'fct_Overview_Status_Phase_1-2-3_Promotion' ),
        'fct_Overview_Status_Phase_1-2-3_Promotion'[Date.1]
            < SELECTEDVALUE ( dim_Deadlines[Deadline] )
    )
)

vzhangti_3-1676254863340.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

2 REPLIES 2
v-zhangti
Community Support
Community Support

Hi, @MarkKemeny 

 

You can try the following methods.
Sample data:

One to many

vzhangti_0-1676254785263.png

vzhangti_2-1676254814170.png

Measure = 
CALCULATE ( COUNTROWS ( 'fct_Overview_Status_Phase_1-2-3_Promotion' ),
    FILTER ( ALL ( 'fct_Overview_Status_Phase_1-2-3_Promotion' ),
        'fct_Overview_Status_Phase_1-2-3_Promotion'[Date.1]
            < SELECTEDVALUE ( dim_Deadlines[Deadline] )
    )
)

vzhangti_3-1676254863340.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

johnt75
Super User
Super User

At the point where you are using RELATED no row context exists, so it cannot traverse the relationship. I think you want something like

My Measure =
VAR MaxDate =
    MAX ( dim_Deadlines[Deadline] )
RETURN
    CALCULATE (
        COUNTROWS ( 'fct_Overview_Status_Phase_1-2-3_Promotion' ),
        'fct_Overview_Status_Phase_1-2-3_Promotion'[Date.1] < MaxDate
    )

As long as some column from your dimension table is in the visual this should work.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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