Forum Discussion

sking5844's avatar
sking5844
New Member
2 years ago

Error Token Eof in expression

I am geting an error returned on the following expression and I cannot seem to determine why through my research.  The goal of the expression is to ensure the tax lot ID in the table is present for all purchase dates in the table.  It is a consistancy data check.  Here is an example of my expression.

 

Tax Lot Consistency Check =
VAR CurrentTaxLotID = [Tax Lot Id Constant 0]
VAR Current Date = [Business close Date]
VAR DistinctTaxLotIDs =
CALCULATE(DISTINCTCOUNT([Tax Lot Id Constant 0],
FILTER(ALLEXCEPT([Business close Date],
[Business close Date] = CurrentDate))
RETURNIF(DistinctTaxLotIDs = 1, TRUE(), FALSE())

6 Replies

  • Try taking the space out in your variable name...

     

    VAR Current Date = [Business close Date]

  • The error is pointing at the Tax Lot Flag text. Presume it's a custom column and that's what you want to name it as? Would suggest to remove that so your code is just = then your Variables.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi sking5844 ,

    This is Power Query Editor

    Power Query's backend language is M code, which means it can only recognize M code. but the code you provided is DAX, which are two completely different programming languages.

    If you need to use the DAX language, go to Power BI Desktop and create measures, calculated columns, or calculated tables to use.
    DAX overview - DAX | Microsoft Learn
    Power Query M formula language reference - PowerQuery M | Microsoft Learn

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

  • Anonymous's avatar
    Anonymous
    Not applicable

    You are trying to use DAX in a Power Query custom column. You can't do that. Power Query uses M, and the data model uses DAX.

     

    --Nate