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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

MailChimp API - Expression Error 'field' of the record not found

Working with the MailChimp API and a field called "list_stats" didn't come through on a few records from the Campaign Summary. Unfortunatly I can't figure out how to transform the table prior to expanding.

 

I've tried

Table.ExpandColumns() without listing 'list_stats' in the function arguements but it still gave errors.

 

I tried to combine some learnings from this blog post  and another from this post. But this codes doesn't work because I'm not trying to transform a List but a Table

Table.TransformColumns(#"Filtered Rows",{{"Data", each List.Transform(_, each Record.SelectFields(_,{"list_stats"},MissingField.UseNull))}})

 

So far I have the basic stuff 

let
Source = MailChimp.TablesV2(),
campaigns = Source{[Key="campaigns"]}[Data],
#"Filtered Rows" = Table.SelectRows(campaigns, each ([Name] = "Campaign Summary")),
#"Removed Other Columns" = Table.SelectColumns(#"Filtered Rows",{"Data"}),
Data = #"Removed Other Columns"{0}[Data],

 errorexpression2.JPG

 

 

errorexpression.JPG

 

I know that @MarcelBeu could answer this but I may have used up my help requests for the week.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

For now, I modified the query...instead of pulling the Campaign Summary UI endpoint I leveraged the Instance function

 

= #"MailChimp Instance"("/reports?since_send_time=2014-01-01&count=500")

 

It gives me the same number of results after I remove the error rows and the rows with "sent_time" = blank

View solution in original post

5 REPLIES 5
v-qiuyu-msft
Community Support
Community Support

Hi @Anonymous,

 

Can you share the results of the step "#"Removed Other Columns""? It seems the issue is the value can't be changed to record type. 

 

You can use below Query to check 14th row, if any column values different from others. 

 

let
Source = MailChimp.TablesV2(),
#"Filtered Rows" = Table.SelectRows(Source, each ([Name] = "Campaigns"))[Data]{0}
in
#"Filtered Rows"

 

Maybe @ImkeF @MarcelBeug have another good suggestions. 

 

Best Regards,
Qiuyun Yu 

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hey @v-qiuyu-msft

 

I modified the code slightly to pull just the campaign summary: = Table.SelectRows(Source, each ([Name] = "Campaign Summary"))[Data]{0}

 

but receive the error message "Expression Error: There weren't enough elements in the enumeration to complete the operation. Details: List"

 

The result of the Removed Other Columns is just a sigle table with The Data field and one value as Table, then if you try to expand the table you get the second screen shot with row 14 showing error. 

 

imagefilter.JPG

 

Some how it needs to modify all records in the table to include the "list_stats" if it doesn't already have it

Anonymous
Not applicable

For now, I modified the query...instead of pulling the Campaign Summary UI endpoint I leveraged the Instance function

 

= #"MailChimp Instance"("/reports?since_send_time=2014-01-01&count=500")

 

It gives me the same number of results after I remove the error rows and the rows with "sent_time" = blank

I'm experiencing a similar issue with this. It is odd, because the query did worked two weeks ago and stop doing it without any changes on it when I updated the data manually this week. The difference with the OP is that I don't get the error on Power Query editor, but afterwards when updating the data. 

The error is the following: 

mailchimp query error.jpg

My user interface is set to Spanish, but the message translates to "Error of OLE DB or ODBC: [Expression.Error] The field 'list_stats' was not found on the registry."

 

I tried the accepted solution, but then I'm unable to run the query. So, this workaround does not seem to be working anymore (at least for my data). 

 

EDIT: I find the solution to my issue and (I think) the one from the OP. This error appears because one or more rows failed to load the record value for the 'list_stats' column, so I just added to my query the following code:

#"Remove errors" = Table.RemoveRowsWithErrors(#"QueryName", {"id"})

before the in #"QueryName"

 

With this your query should run correctly. 

Hi @pvazig I know this reply is very late. Since there’s no built-in connector for Mailchimp to PBI anymore, you will have to look for another way. As a workaround, maybe you can use a 3rd party connector, it can save you a lot of time compared to other options. I've tried windsor.ai, supermetrics and funnel.io. I stayed with windsor because it is much cheaper so just to let you know other options. In case you wonder, to make the connection first search for the Mailchimp connector in the data sources list:

 

MAILCHIMP-1.jpg

 

After that, you will have to first create a secret API key in your Mailchimp account and then using your credentials add your account to the platform.

 

MAILCHIMP-2.jpg

 

Once you’ve done this, you can proceed and go to the “Preview and destination” step

 

MAILCHIMP-3.jpg

 

There just select the fields you need. Finally, just select PBI as your data destination and finally just copy and paste the url on PBI --> Get Data --> Web --> Paste the url. 

 

SELECT_DESTINATION_NEW.png

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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