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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Laho
Helper I
Helper I

Expression.Error: We cannot convert the value {x} to type Text.

Hi,

 

I have 1 column with id and want to add an extra column webrequest based on that id(parameter).

Stuck on the "Expression.Error: We cannot convert the value 5 to type Text.".

 

Usually you would say something is wrong with my id column. But did correct formatting, removed blanks and errors. The parameter seems to be correct, as the error returns the correct id.

 

     DynamicAPICallColumn = (id as text) as list=>

            let 

                Response = Json.Document(
                    Web.Contents("https://api.pipedrive.com/v1/deals/",
                        [RelativePath= "" & id & "/products",
                        Query=[start=0, include_product_data=0, api_token="xxxxxxxx"]]
                    )
                )
            
            in

    Response,
    #"Added Custom1" = Table.AddColumn(#"Removed Errors", "APICall", each DynamicAPICallColumn([id]))

Been trough a lot. Maybe some can assist me. 

1 ACCEPTED SOLUTION

Was indeed some data that cannot be parsed, but not specifically (only) the id column. Updated the following:

 

  DynamicAPICallColumn = (id) =>

            let 

                Response = Json.Document(
                    Web.Contents("https://api.pipedrive.com/v1/deals/",
                        [RelativePath= "" & Number.ToText(id) & "/products",
                        Query=[start="0", include_product_data="0", api_token="xxxx"]]
                    )
                ),
                Data = Response[data]
            
            in

    Data,
  #"Added Custom1" = Table.AddColumn(#"Removed Errors", "APICall", each DynamicAPICallColumn([id])),

Works like a charm now. Thanks

View solution in original post

2 REPLIES 2
dax
Community Support
Community Support

Hi Laho,

This might be related to data type, you could try to change type at first , then add column(like below)

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlSK1YlWMgKTxmDSBEyCCTOl2FgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [id = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"id", type number}}),
    
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each [id])
in
#"Added Custom"

You could refer to  Power Query Error Expression.Error: We cannot convert the value .. to type Text for details.

Best Regards,

Zoe Zhi

 

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

Was indeed some data that cannot be parsed, but not specifically (only) the id column. Updated the following:

 

  DynamicAPICallColumn = (id) =>

            let 

                Response = Json.Document(
                    Web.Contents("https://api.pipedrive.com/v1/deals/",
                        [RelativePath= "" & Number.ToText(id) & "/products",
                        Query=[start="0", include_product_data="0", api_token="xxxx"]]
                    )
                ),
                Data = Response[data]
            
            in

    Data,
  #"Added Custom1" = Table.AddColumn(#"Removed Errors", "APICall", each DynamicAPICallColumn([id])),

Works like a charm now. Thanks

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Solution Authors