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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.