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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

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
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.