//Original
data = Json.Document(Web.Contents(ParamApiEndpoint & “/GetGeneralLedgerTrialBalanceReportData?MonthEndDate=2021-10-31&NumberOfMonthIncluded=36”,
// Test 1 data = Json.Document(Web.Contents(ParamApiEndpoint & “/GetGeneralLedgerTrialBalanceReportData?MonthEndDate=&Text.From(MonthEnd)&NumberOfMonthIncluded=36”,
// Test 2 data = Json.Document(Web.Contents(ParamApiEndpoint & “/GetGeneralLedgerTrialBalanceReportData?MonthEndDate=&Text.From(#“MonthEnd”)&NumberOfMonthIncluded=36”,
// Test 3 data = Json.Document(Web.Contents(ParamApiEndpoint & “/GetGeneralLedgerTrialBalanceReportData?MonthEndDate=&“Text.From(#“MonthEnd”)” &NumberOfMonthIncluded=36”,
In your original code snippet your date is formatted as yyyy-mm-dd
This #“MonthEnd” query will return a string in that format
let
Today = Date.From( DateTime.FixedLocalNow() ),
MonthEnd = if Today = Date.EndOfMonth( Today ) then Today else Date.EndOfMonth( Date.AddMonths( Today, -1)),
DateString = Text.Combine( List.Reverse( Text.SplitAny( Text.From( MonthEnd ), "-/" )), "-")
in
DateString
Incorporating that code, will look something like:
data = Json.Document(Web.Contents(ParamApiEndpoint & “/GetGeneralLedgerTrialBalanceReportData?MonthEndDate="&#“MonthEnd”&"NumberOfMonthIncluded=36”,