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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Anonymous
Not applicable

Invalid Token: Measure in PowerBI

Good morning all

I'm trying to create a measure to give me a % of assessments that were completed in a given period of time, but I keep getting the invalid token error, the trouble is I'm not sure what it is referring to, it currently is giving me "line 1, offset 282" but when I make changes the offset changes. 

Here's my code:

upcoming Assessments Complete = CALCULATE(DISTINCTCOUNT( ASSESSMENT_TASKS[MEMBER_NBR]), OR(ASSESSMENT_TASKS[ASSESSMENT_STATUS] = "Assessed late", ASSESSMENT_TASKS[ASSESSMENT_STATUS] = "Assessed on time"), OR (ASSESSMENT_TASKS[DAYS UNTIL DUE] = "14 DAYS OR LESS",ASSESSMENT_TASKS[Days Until Due] = "15 TO 45 DAYS"])) / CALCULATE(DISTINCTCOUNT(ASSESSMENT_TASKS[MEMBER_NBR]), OR (ASSESSMENT_TASKS[DAYS UNTIL DUE]= "14 DAYS OR LESS", ASSESSMENT_TASKS[Days Until Due]= "15 TO 45 DAYS"))
 
Any advice would be very helpful! Thank you so much!
 
 
1 ACCEPTED SOLUTION
v-kkf-msft
Community Support
Community Support

Hi @Anonymous ,

 

This error message is an indication that there is a problem with your syntax. I found an extra "]" in your code, please remove it and run it again. 

 

vkkfmsft_0-1655791768364.png

 

Also, you can format the DAX in this URL https://www.daxformatter.com/  to make it more beautiful.

 

upcoming Assessments Complete =
CALCULATE (
    DISTINCTCOUNT ( ASSESSMENT_TASKS[MEMBER_NBR] ),
    OR (
        ASSESSMENT_TASKS[ASSESSMENT_STATUS] = "Assessed late",
        ASSESSMENT_TASKS[ASSESSMENT_STATUS] = "Assessed on time"
    ),
    OR (
        ASSESSMENT_TASKS[DAYS UNTIL DUE] = "14 DAYS OR LESS",
        ASSESSMENT_TASKS[Days Until Due] = "15 TO 45 DAYS"
    )
)
    / CALCULATE (
        DISTINCTCOUNT ( ASSESSMENT_TASKS[MEMBER_NBR] ),
        OR (
            ASSESSMENT_TASKS[DAYS UNTIL DUE] = "14 DAYS OR LESS",
            ASSESSMENT_TASKS[Days Until Due] = "15 TO 45 DAYS"
        )
    )

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
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

3 REPLIES 3
v-kkf-msft
Community Support
Community Support

Hi @Anonymous ,

 

This error message is an indication that there is a problem with your syntax. I found an extra "]" in your code, please remove it and run it again. 

 

vkkfmsft_0-1655791768364.png

 

Also, you can format the DAX in this URL https://www.daxformatter.com/  to make it more beautiful.

 

upcoming Assessments Complete =
CALCULATE (
    DISTINCTCOUNT ( ASSESSMENT_TASKS[MEMBER_NBR] ),
    OR (
        ASSESSMENT_TASKS[ASSESSMENT_STATUS] = "Assessed late",
        ASSESSMENT_TASKS[ASSESSMENT_STATUS] = "Assessed on time"
    ),
    OR (
        ASSESSMENT_TASKS[DAYS UNTIL DUE] = "14 DAYS OR LESS",
        ASSESSMENT_TASKS[Days Until Due] = "15 TO 45 DAYS"
    )
)
    / CALCULATE (
        DISTINCTCOUNT ( ASSESSMENT_TASKS[MEMBER_NBR] ),
        OR (
            ASSESSMENT_TASKS[DAYS UNTIL DUE] = "14 DAYS OR LESS",
            ASSESSMENT_TASKS[Days Until Due] = "15 TO 45 DAYS"
        )
    )

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

@EZeddie @v-kkf-msft Well spotted @EZeddie!

It's worth mentioning a method I often use to find out what's causing an error like this is to create the measure with one clause at a time, see if it works (or at least doesn't give an error), and then add the next bit until the error pops up. For example, first I would create the measure as

upcoming Assessments Complete = 1

then

upcoming Assessments Complete = CALCULATE ( DISTINCTCOUNT ( ASSESSMENT_TASKS[MEMBER_NBR] ))

then

upcoming Assessments Complete =
CALCULATE (
    DISTINCTCOUNT ( ASSESSMENT_TASKS[MEMBER_NBR] ),
    ASSESSMENT_TASKS[ASSESSMENT_STATUS] = "Assessed late"
)

and so on. Once you add a clause that gives an error, it will likely mean the error is in the clause just added. 

 

Useful to narrow down the location of an error.

Anonymous
Not applicable

@Anonymous , try removing all the line breaks in the measure and put it all in one line. If the DAX editor does force a line-break, make sure it doesn't line-break in the middle of a tablename or fieldname.

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.