Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi, I'm importing the data through an API when I click on refresh it thorws an error stating "Cannot convert value null to type List"
please help I've attached pbix and screenshots below.
This is M code I'm using rn:
let
Source = List.Generate( ()=> [Result= try PageData(1) otherwise null, PageNumber = 1], each List.Count([Result]) >1, each [Result= try PageData([PageNumber]) otherwise null, PageNumber = [PageNumber] +1], each [Result]),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandListColumn(#"Converted to Table", "Column1"),
#"Expanded Column2" = Table.ExpandRecordColumn(#"Expanded Column1", "Column1", {"id", "summary", "recordType", "board", "status", "company", "site", "siteName", "addressLine1", "city", "stateIdentifier", "zip", "country", "contact", "contactName", "contactPhoneNumber", "contactEmailAddress", "type", "team", "owner", "priority", "serviceLocation", "source", "severity", "impact", "allowAllClientsPortalView", "customerUpdatedFlag", "automaticEmailContactFlag", "automaticEmailResourceFlag", "automaticEmailCcFlag", "closedDate", "closedBy", "closedFlag", "actualHours", "approved", "estimatedExpenseCost", "estimatedExpenseRevenue", "estimatedProductCost", "estimatedProductRevenue", "estimatedTimeCost", "estimatedTimeRevenue", "billingMethod", "subBillingMethod", "dateResolved", "dateResplan", "dateResponded", "resolveMinutes", "resPlanMinutes", "respondMinutes", "isInSla", "resources", "hasChildTicket", "hasMergedChildTicketFlag", "billTime", "billExpenses", "billProducts", "location", "department", "mobileGuid", "sla", "currency", "_info", "customFields", "agreement", "contactPhoneExtension", "automaticEmailCc", "subType", "item", "opportunity", "poNumber", "budgetHours", "parentTicketId", "mergedParentTicket", "addressLine2", "billingAmount", "knowledgeBaseLinkId", "knowledgeBaseLinkType"}, {"id", "summary", "recordType", "board", "status", "company", "site", "siteName", "addressLine1", "city", "stateIdentifier", "zip", "country", "contact", "contactName", "contactPhoneNumber", "contactEmailAddress", "type", "team", "owner", "priority", "serviceLocation", "source", "severity", "impact", "allowAllClientsPortalView", "customerUpdatedFlag", "automaticEmailContactFlag", "automaticEmailResourceFlag", "automaticEmailCcFlag", "closedDate", "closedBy", "closedFlag", "actualHours", "approved", "estimatedExpenseCost", "estimatedExpenseRevenue", "estimatedProductCost", "estimatedProductRevenue", "estimatedTimeCost", "estimatedTimeRevenue", "billingMethod", "subBillingMethod", "dateResolved", "dateResplan", "dateResponded", "resolveMinutes", "resPlanMinutes", "respondMinutes", "isInSla", "resources", "hasChildTicket", "hasMergedChildTicketFlag", "billTime", "billExpenses", "billProducts", "location", "department", "mobileGuid", "sla", "currency", "_info", "customFields", "agreement", "contactPhoneExtension", "automaticEmailCc", "subType", "item", "opportunity", "poNumber", "budgetHours", "parentTicketId", "mergedParentTicket", "addressLine2", "billingAmount", "knowledgeBaseLinkId", "knowledgeBaseLinkType"}),
#"Changed Type with Locale" = Table.TransformColumnTypes(#"Expanded Column2", {{"closedDate", type datetime}}, "en-US"),
#"Changed Type" = Table.TransformColumnTypes(#"Changed Type with Locale",{{"actualHours", type number}, {"closedDate", type date}})
in
#"Changed Type"
Pbix link :
https://drive.google.com/file/d/1qvuvLt3VPm6eU3103qWil47LJZivZZu0/view?usp=sharing
@Anonymous
I can't open your pbix.
You can check the column with the error to see if there is a null value in it, if there is a null value, replace it with Replace Values.
Transform -- Replace Values.
This is a link to related content, hope it will help you:
https://community.powerbi.com/t5/Desktop/Cannot-convert-value-null-to-type-List/m-p/893014
https://community.powerbi.com/t5/Power-Query/Cannot-convert-to-type-List/m-p/1971275
Best Regards,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@V-pazhen-msft thank you for responding.
Can you open the pbix I can't perform replace values it is giving me the error at the source when I'm trying to get the data through API.
You can open the pbix -> Transform->Edit credentials-> anomymous
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
90 | |
88 | |
83 | |
64 | |
49 |
User | Count |
---|---|
127 | |
108 | |
87 | |
70 | |
66 |