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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors