Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Create a empty Table if Table has no values

Hi,   I need to fill a empty Table with (empty) values, because my Data Load is based on the month and so it can be empty(with no Columns), but then PowerBI reports an error if I refresh the data. ...
  • Anonymous's avatar
    Anonymous
    7 years ago

    Hi Anonymous ,

     

    I think this issue should more related to your formula:

    let
        Source = #table(1,{OData.Feed("link")}),
        #"Expanded Column1" = if Table.IsEmpty(Source)=true then #table(type table[#"Column1" ,type any],{}) else Table.ExpandRecordColumn(Source, "Column1",{"Columnnames"})
    in
        #"Expanded Column1"

     

    My test sample:

    let
        Source = try OData.Feed("1https://services.odata.org/V3/Northwind/Northwind.svc") otherwise #table(type table[#"ColumnName"=text],{}),
        #"Changed Type" = if Table.IsEmpty(Source)= false then Table.TransformColumnTypes(Source, {{"Name",type any},{"Data",type any},{"Signature",type any}}) else Source
    in
        #"Changed Type"

     

    Regards,

    Xiaoxin Sheng