Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. 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.
@Anonymous 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
User | Count |
---|---|
79 | |
74 | |
63 | |
45 | |
44 |
User | Count |
---|---|
101 | |
43 | |
39 | |
39 | |
36 |