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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Passing list items to functions with different argument requirements

I am attempting to have a function call an API request for each day of the year. I want to achieve this by having the function "Query2" make a call for each day which is provided by a pre-generated list.

Query2 Function:

(dayDate as date) as table =>
let
    Source = Xml.Tables(Web.Contents("https://API.EXAMPLE.com/api/stats/groups/104/interactions?d=" & Date.ToText(#date(dayDate)))),
    Table0 = Source{0}[Table],
    #"Changed Type" = Table.TransformColumnTypes(Table0,{{"media-type", type text}, {"origination", type text}, {"create-timestamp", type datetimezone}, {"wrap-up-code", type text}, {"wrap-up-text", type text}, {"is-interaction-completed", type logical}})
in
    #"Changed Type"

The table with generated dates is:

let
    DateRange= List.Dates(#date(2019,01,01),365,#duration(1,0,0,0)),
    Source = List.Transform(DateRange, each try {(_), Query2(_)} otherwise null),
    First = List.FirstN(Source, each _ <> null),
    Table = Table.FromRows(First, {"date", "Column1"}),
    #"Changed Type" = Table.TransformColumnTypes(Table,{{"date", type date}})
in
    #"Changed Type"

I am receiving one of two errors. The first comes with the above code:

An error occurred in the ‘’ query. Expression.Error: 1 arguments were passed to a function which expects 3.
Details:
    Pattern=
    Arguments=List

When the call for "Query2" is adjusted to "Query2(_,"","") I recieve the following error:

Expression.Error: 3 arguments were passed to a function which expects 1.
Details:
    Pattern=
    Arguments=List



So I am assuming I have at least two functions that have different expected number of arguments but do not know how to resolve this.

 

Thanks.

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

@Anonymous 

 

#date function needs 3 paramaters.

Perhaps adjust the function as follows

 

(dayDate as date) as table =>
let
    Source = Xml.Tables(Web.Contents("https://API.EXAMPLE.com/api/stats/groups/104/interactions?d=" & 
Date.ToText(#date(Date.Year(dayDate),Date.Month(dayDate),Date.Day(dayDate))))), Table0 = Source{0}[Table], #"Changed Type" = Table.TransformColumnTypes(Table0,{{"media-type", type text}, {"origination", type text}, {"create-timestamp", type datetimezone}, {"wrap-up-code", type text}, {"wrap-up-text", type text}, {"is-interaction-completed", type logical}}) in #"Changed Type"

View solution in original post

1 REPLY 1
Zubair_Muhammad
Community Champion
Community Champion

@Anonymous 

 

#date function needs 3 paramaters.

Perhaps adjust the function as follows

 

(dayDate as date) as table =>
let
    Source = Xml.Tables(Web.Contents("https://API.EXAMPLE.com/api/stats/groups/104/interactions?d=" & 
Date.ToText(#date(Date.Year(dayDate),Date.Month(dayDate),Date.Day(dayDate))))), Table0 = Source{0}[Table], #"Changed Type" = Table.TransformColumnTypes(Table0,{{"media-type", type text}, {"origination", type text}, {"create-timestamp", type datetimezone}, {"wrap-up-code", type text}, {"wrap-up-text", type text}, {"is-interaction-completed", type logical}}) in #"Changed Type"

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors