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
wbarnes
Frequent Visitor

I keep getting Syntax errors, can someone help me please?

Here's my measure: 

Provider ID =
IF(
    ISBLANK(
        LOOKUPVALUE(
            'Provider Lookup'[Provider ID],
            'Provider Lookup'[Provider Name],
            'Code Stroke DDR'[Who provided Telestroke Service]
        )
    ),
    "No ID",  -- Default text value for blank entries
    FORMAT(
        LOOKUPVALUE(
            'Provider Lookup'[Provider ID],
            'Provider Lookup'[Provider Name],
            'Code Stroke DDR'[Who provided Telestroke Service]
        ),
        "General Number"  -- Converts numeric values to text
    )
)
Here's the Syntax Error: 
The following syntax error occurred during parsing: Invalid token, Line 4, Offset 5,  .
1 ACCEPTED SOLUTION
rohit1991
Super User
Super User

Hi @wbarnes ,

In DAX, string outputs in a measure must be returned as a DAX expression, not as comments (i.e., you can’t use -- for comments inside the formula). Also, "General Number" is not a valid format string for FORMAT—use "#" or just wrap the number in FORMAT without a format string.

Provider ID =
VAR ProviderID = 
    LOOKUPVALUE(
        'Provider Lookup'[Provider ID],
        'Provider Lookup'[Provider Name],
        'Code Stroke DDR'[Who provided Telestroke Service]
    )
RETURN
IF(
    ISBLANK(ProviderID),
    "No ID",
    FORMAT(ProviderID, "")
)

Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

View solution in original post

2 REPLIES 2
wbarnes
Frequent Visitor

Hi @rohit1991,

That worked perfectly, and thanks for the explanation as to why my measure was not working!!!

rohit1991
Super User
Super User

Hi @wbarnes ,

In DAX, string outputs in a measure must be returned as a DAX expression, not as comments (i.e., you can’t use -- for comments inside the formula). Also, "General Number" is not a valid format string for FORMAT—use "#" or just wrap the number in FORMAT without a format string.

Provider ID =
VAR ProviderID = 
    LOOKUPVALUE(
        'Provider Lookup'[Provider ID],
        'Provider Lookup'[Provider Name],
        'Code Stroke DDR'[Who provided Telestroke Service]
    )
RETURN
IF(
    ISBLANK(ProviderID),
    "No ID",
    FORMAT(ProviderID, "")
)

Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

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.