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
rpiboy_1
Helper V
Helper V

OLE OBDC error: help interpreting auto generated error query

I was getting the following error:

 

failed to save modifications to the server. error returned 'ole db or odbc error: [Expression.Error] We cannot convert the value null to type Function

 

After some back-tracking through referenced queries I was able to get PowerBI to generate a query error, but I don't understand it at all! What I also don't understand is why I'm getting an error. In the Power Query editor, the query in question 'looks' valid. The error only gets thrown when I try to load the query (or a downstream referenced query).

My understanding is that basically the query is returning empty when attempting to load, even though it it not empty in the Editor.
'ProjectAdmin' is the query that 'looks' ok in the Editor. The only thing 'unqiue' about this query is that one of the columns contains a list in each record, which I have not expanded; the intent is to expand the list downstream in referenced query(s).

 

I don't understand what this code is 'analyzing' where it arrives at a null state with no rows.

 

 

 

let
Source = ProjectAdmin,
  #"Detected Type Mismatches" = let
    tableWithOnlyPrimitiveTypes = Table.SelectColumns(Source, Table.ColumnsOfType(Source, {type nullable number, type nullable text, type nullable logical, type nullable date, type nullable datetime, type nullable datetimezone, type nullable time, type nullable duration})),
    recordTypeFields = Type.RecordFields(Type.TableRow(Value.Type(tableWithOnlyPrimitiveTypes))),
    fieldNames = Record.FieldNames(recordTypeFields),
    fieldTypes = List.Transform(Record.ToList(recordTypeFields), each [Type]),
    pairs = List.Transform(List.Positions(fieldNames), (i) => {fieldNames{i}, (v) => if v = null or Value.Is(v, fieldTypes{i}) then v else error [Message = "The type of the value does not match the type of the column.", Detail = v], fieldTypes{i}})
in
    Table.TransformColumns(Source, pairs),
  #"Added Index" = Table.AddIndexColumn(#"Detected Type Mismatches", "Row Number" ,1),
  #"Kept Errors" = Table.SelectRowsWithErrors(#"Added Index", {"ServerCodes", "ProjDataTypes", "AdminData"}),
  #"Reordered Columns" = Table.ReorderColumns(#"Kept Errors", {"Row Number", "ServerCodes", "ProjDataTypes", "AdminData"})
in
  #"Reordered Columns"

 

 

 

 

3 REPLIES 3
rpiboy_1
Helper V
Helper V

It definently seems like the iteration is the issue whether it is iteration over the possible servers (unique functions) or iteration over the arguements (datatype) if I try to load any query that is iterative, it fails. suggestions most welcome!

rpiboy_1
Helper V
Helper V

Not sure it helps or not, but here is the M-Code for the query that is failing to load. Not terribly complex. For each server there is a function that is called. The function takes an arguement for the data type to query from the REST endpoint.

let
    //join the server code query with the project data type query
    #"Added Custom" = Table.AddColumn(lst_ServerCodes, "ProjectAdminDataType", each lst_ProjectDataTypes),
    //expand the data types column to create a cross-join
    #"Expanded ProjectAdminDataType" = Table.ExpandTableColumn(#"Added Custom", "ProjectAdminDataType", {"ProjDataTypes"}, {"ProjDataTypes"}),
    // change the type on the new column
    #"Changed Type" = Table.TransformColumnTypes(#"Expanded ProjectAdminDataType",{{"ProjDataTypes", type text}}),
    //execute custom function to iterate through each server and data type to get data
    #"ExecuteFunction" = Table.AddColumn( 
        #"Changed Type",
        "AdminData",
        each Function.Invoke(    
            Expression.Evaluate(
                "FnAdminQuery"&[ServerCodes],
                #shared
            ),
            {[ProjDataTypes]}
        )
    )
in
    ExecuteFunction

I've done some further testing where I removed the iterative process and directly called one function with one arguement and the results of that query loads, so there seems to be something that power query does not like about iterating through an determining which function to apply, then applying it For Each possible arguement value.

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