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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
MattRiley
New Member

Power Query Error

Hi all, 

 

I am a relative novice at all of this and have been provided with a query to use when importing data. They cannot help more than that but I was hoping someone could point me in the right direction. 

 

When inputting this into Advanced Query Editor I am getting an error on the bold highlighed text below. Any ideas what this should be replaced with?

 

Thank in advance for any help. 

 

 

let
    Source = Json.Document(Web.Contents("http://api.XXXXcom/api/v1/survey?limit=1", [Headers=[X_XXX_APITOKEN=XXXXX]])),
    AllPages = {1..(Number.IntegerDivide(Source[total]-1, 1000)+1)},
    AllPagesList = Table.FromList(AllPages, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    AllPagesListText = Table.TransformColumnTypes(AllPagesList,{{"Column1", type text}}),
    AllPagesListWithData = Table.AddColumn(AllPagesListText, "Data", each getSurveyPage([Column1])),
    Data = Table.ExpandTableColumn(AllPagesListWithData, "Data", {"_id", "survey_type_code", "closed", "rating", "contact_email", "contact_name", "_updated_at", "_created_at", "ip_address", "reviewed", "employees", "surveyTagsCompany", "surveyTagsCustomer", "inactive", "rating_label", "comment", "ticket_num"}, {"_id", "survey_type_code", "closed", "rating", "contact_email", "contact_name", "_updated_at", "_created_at", "ip_address", "reviewed", "employees", "surveyTagsCompany", "surveyTagsCustomer", "inactive", "rating_label", "comment", "ticket_num"})
in
    Data

5 REPLIES 5
MattRiley
New Member

MattRiley_0-1616058354238.jpeg

Unfortunately this is all I am getting for an error message and I have no M code. The supplier of the api do not have any PowerBi knowledge so cannot help me any further. 

Hi, @MattRiley 

 

Do you have a query called 'getSurveyPage'? It seems the wrong reference caused this error.

 

Best Regards

Allan

 

 

Unfortunately not. I assumed that was supposed to be replaced by something else but I havent been able to establish what. With the exception of the PowerQuery script above, the only other information they are able to provide is a short how-to guide as below:

 

https://get-help-tnt.crewhu.com/hc/en-us/articles/360041925673-Power-BI-Integration-Open-API

 

Unfortunately doing it this was has a limit of only 100 lines so isnt going to be too helpful for me. 

Anonymous
Not applicable

Hi @MattRiley 

 

What is the error message? It looks like getSurveyPage is a customized function, so do you have the M code for it since it is not included in this query?

MattRiley_2-1616068894092.jpeg

Unfortunately this is all I am getting for an error message and I have no M code. The supplier of the api do not have any PowerBi knowledge so cannot help me any further. 

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.