Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowJuly 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more
Hi All,
I'm stuck right now
I have code like this to get how much the total page of this API (source data)
And when I try to invoke custom function, I got error like this
If the function running well, the output present how much the total page
Any solution ?
Please help
Thanks
Hi @m-colbert
Here's the code
(SelectedService as text) =>
let
BaseURL = "https://testing.com", //example API
ConstantVar = "test/rest/CheckAPI/GetData?PageSize=""&PageNumber=""&Building=""&Category=""&Location=""&Status=""&StartDate=""&EndDate=""&StartTime={StartTime}&EndTime=", // example var
StartDate = "2021-10-19",
CurrentYear = Text.End("0000" & Number.ToText(Date.Year(Date.From(DateTime.LocalNow()))),4),
CurrentMonth = Text.End("00" & Number.ToText(Date.Month(Date.From(DateTime.LocalNow()))),2),
CurrentDay = Text.End("00" & Number.ToText(Date.Day(Date.From(DateTime.LocalNow()))),2),
EndDate = CurrentYear & "-" & CurrentMonth & "-" & CurrentDay,
response = Web.Contents(
#"BaseURL",
[
Headers =
[
Authorization= "test test" // username and pass (basic auth)
],
RelativePath = #"ConstantVar" & SelectedService,
Query =
[
start_dt = StartDate,
end_dt = EndDate,
page = Number.ToText(1)
]
]
),
jsonResponse = Json.Document(response),
#"Converted to table" = Record.ToTable(jsonResponse),
#"Filtered rows" = Table.SelectRows(#"Converted to table", each ([Name] = "total_page")),
#"Removed columns" = Table.RemoveColumns(#"Filtered rows", {"Name"}),
#"Changed column type" = Table.TransformColumnTypes(#"Removed columns", {{"Value", Int64.Type}}),
#"Renamed columns" = Table.RenameColumns(#"Changed column type", {{"Value", "TotalPage"}})
in
#"Renamed columns"
Thaks
Need some addtional information to help. Can you possibly paste the code in text, I am unable to see it, too small. Also, click on the error and paste in what the error text is.
Thanks
Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.
| User | Count |
|---|---|
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
| User | Count |
|---|---|
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 |