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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
domtrump
Helper I
Helper I

dax query related error

I am new to writing DAX queries. I started with this simple one as a test. (I am writing this in DAX Studio as a test.)

/* START QUERY BUILDER */
EVALUATE
SUMMARIZECOLUMNS(
    PennyPurge[AccountID],
    "Ldate",related(ASTData[LastDatePlayed])
)
ORDER BY 
    PennyPurge[AccountID] ASC,
    ASTData[LastDatePlayed] ASC
/* END QUERY BUILDER */

 

In my data model, ASTData is a lookup table and DOES have a 1 to many relationship to PennyPurge. Just running this simple query results in the follong error:

domtrump_0-1711218908018.png

Why would it say there is no relationship when there absolutely is? What is meant by "the current context?" The field definitely exists. Here is a screenshot from the model:

domtrump_1-1711219172469.png

 

Like I said, new to this so please let me know if more information is needed (short of recreating the tables). Thanks.

 

5 REPLIES 5
v-yilong-msft
Community Support
Community Support

Hi @domtrump ,

Have you solved your problem? If so, can you share your solution here and mark the correct answer as a standard answer to help other members find it faster? Thank you very much for your kind cooperation!

 

 

Best Regards

Yilong Zhou

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

sjoerdvn
Super User
Super User

You are getting this error because you're using STData[LastDatePlayed] in the ORDER BY and it's not in the column list of the SUMMARIZECOLUMNS.
Also, you can not use RELATED like that:

  • The RELATED function needs a row context; therefore, it can only be used in calculated column expression, where the current row context is unambiguous, or as a nested function in an expression that uses a table scanning function. A table scanning function, such as SUMX, gets the value of the current row value and then scans another table for instances of that value.

 

AnalyticPulse
Impactful Individual
Impactful Individual

instead of writing it in dax studio did you tried it in powerbi itself?

Not currently using Power BI. Just PowerPivot in Excel. My goal is to query directly out of the data model but using a filter from the lookup table.

domtrump
Helper I
Helper I

Tried this as well, but get the same error.

/* START QUERY BUILDER */
EVALUATE
NATURALLEFTOUTERJOIN ( PennyPurge, ASTData )
evaluate
SUMMARIZECOLUMNS(
    PennyPurge[AccountID],
    "Ldate",related(ASTData[LastDatePlayed])
)
ORDER BY 
    PennyPurge[AccountID] ASC,
    ASTData[LastDatePlayed] ASC
/* END QUERY BUILDER */

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Fabric Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors