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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
cleon169
Frequent Visitor

missing columns not returned when iterate through web service

I'm calling a SOAP API in XML to pull down a report into Power Query. The query iterates through a list of locations stored in a manual table. The problem I have is when the location doesn't have a value for a column, it doesn't return the column at all. This is resulting in the power query erroring out when it can't find the column. I'm assuming I need to define the elements using something like an element path, but I'm clueless on how to do that in the XML. Can anyone help please?

 

For example, I'm getting this error:

 

An error occurred in the ‘’ query. Expression.Error: The column 'MoveIn' of the table wasn't found.
Details:
    MoveIn

 

Here's the query:

(AllLocations) as table =>

let

MTDBegin = DateTime.ToText(Date.StartOfMonth(DateTime.LocalNow()), "yyyy-MM-ddT00:00:00"),
MTDEnd = DateTime.ToText(DateTime.LocalNow(), "yyyy-MM-ddThh:mm:ss"),

    Source = Xml.Tables(Web.Contents("https://.../...Ws.asmx?WSDL"

    ,[Content=Text.ToBinary("<soapenv:Envelope xmlns:soapenv="&Character.FromNumber(34)&"http://schemas.xmlsoap.org/soap/envelope/"&Character.FromNumber(34)&" xmlns:rep="&Character.FromNumber(34)&"http:/.../ReportingWs"&Character.FromNumber(34)&">
     <soapenv:Header/>
   <soapenv:Body>
      <rep:MoveInsAndMoveOuts>

         <!--Optional:-->
         <rep:sLocationCode>"&AllLocations&"</rep:sLocationCode>
         <!--Optional:-->
         <rep:sCorpUserName>...</rep:sCorpUserName>
         <!--Optional:-->
         <rep:sCorpPassword>...</rep:sCorpPassword>
         <rep:dReportDateStart>"&MTDBegin&"</rep:dReportDateStart>
         <rep:dReportDateEnd>"&MTDEnd&"</rep:dReportDateEnd>
      </rep:MoveInsAndMoveOuts>
   </soapenv:Body>

</soapenv:Envelope>"),Headers=[#"Accept-Encoding"="gzip,deflate", #"Content-Type"="text/xml;charset=UTF-8"]])),
    Table = Source{0}[Table],
    Table3 = Table{0}[Table],
    Table4 = Table3{0}[Table],
    Table5 = Table4{0}[Table],
    Table6 = Table5{1}[Table],
    Table7 = Table6{0}[Table],
    Table8 = Table7{0}[Table],
    Table9 = Table8{0}[Table],
    Table10 = Table9{0}[Table],
    #"Changed Type" = Table.TransformColumnTypes(Table10,{{"SiteID", Int64.Type}, {"MoveIn", Int64.Type}, {"MoveOut", Int64.Type}, {"Transfer", Int64.Type}, {"MoveDate", type datetimezone}, {"UnitName", type text}, {"TenantName", type text}, {"Width", type number}, {"Length", type number}, {"UnitSize", type text}, {"StandardRate", type number}, {"MovedInArea", type number}, {"MovedInRentalRate", type number}, {"MovedInVariance", type number}, {"MovedInDaysVacant", Int64.Type}, {"MovedOutArea", type number}, {"MovedOutRentalRate", type number}, {"MovedOutVariance", type number}, {"MovedOutDaysRented", Int64.Type}, {"Address", type text}, {"City", type text}, {"Region", type text}, {"PostalCode", Int64.Type}, {"dcDiscount", type number}, {"iLeaseNum", Int64.Type}, {"dRentLastChanged", type datetimezone}, {"sEmpInitials", type text}, {"TenantID", Int64.Type}, {"iAuctioned", Int64.Type}, {"dcPushRateAtMoveIn", type number}, {"dcStdRateAtMoveIn", type number}, {"bPower", type logical}, {"bClimate", type logical}, {"bAlarm", type logical}, {"bInside", type logical}, {"sUnitType", type text}, {"iDaysSinceMoveOut", Int64.Type}, {"dcAmtPaid", type number}, {"InquiryEmployeeID", Int64.Type}, {"CorpUserID_ConvertedToMoveIn", Int64.Type}})

in
#"Changed Type"

 

 

1 REPLY 1
v-yuezhe-msft
Microsoft Employee
Microsoft Employee

@cleon169,

I note that the #"Changed Type" step metions the 'MoveIn' column. When your table doesn't have this column, the above error will throw. Please delete the "Change Type" step under "APPLED STEPS" in Query Editor of Power BI Desktop.

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors