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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
d215aquitania
Frequent Visitor

Expression.Error: se pasaron 3 argumentos a una función que espera entre 1 y 2. - ayuda por favor

Estoy recibiendo este error que me está volviendo loco que espero que alguien pueda detectar justo lo que estoy haciendo mal. Estoy seguro de que debe tener algo que ver con las fechas que estoy usando, pero ¿qué? Todo lo que he intentado sigue volviendo al mismo problema.

Esta es la función que se llama:

Dejar
Source2 (MyStartDate as date, MyEndDate as date, MyTimeUnit as text, MyAPIKey as text) como tabla ?>
Dejar
Origen: Json.Document(Web.Contents("https://monitoringapi.solaredge.com",
[
RelativePath"sitio/123456/energía"
],
[
Consulta" "startDate" & Date.ToText(MyStartDate, "aaaa-mm-dd")
& "&endDate" & Date.ToText(MyEndDate, "aaaa-mm-dd")
& "&timeUnit" & MyTimeUnit
& "&api_key" & MyAPIKey
]
)
),
"Convertido en tabla" - Record.ToTable(Source),
"Valor expandido" - Table.ExpandRecordColumn('Converted to Table', 'Value", ''timeUnit'', 'unit', "measuredBy", 'values'', ''timeUnit'', 'unit', "measuredBy", "values"'),
"Valores expandidos" - Table.ExpandListColumn('''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
"Valores expandidos1" - Table.ExpandRecordColumn("Valores expandidos", "valores", "fecha", "valor", "fecha", "fecha", "valor")
En
"Valores expandidos1"
En
Fuente2

Y aquí está la llamada:

Dejar
Fuente: URL,
"Función personalizada invocada" - Table.AddColumn(Source, "Usage", each Usage([StartDate], [EndDate], [TimeUnit], [api_key]))
En
"Función personalizada invocada"

Timeunit es sólo un texto ("cuarto de hora") y el api_key simplemente texto. StartDate & EndDate son fechas.

¿Alguien puede detectar algo que pueda cambiar aquí?

Gracias de antemano.

1 ACCEPTED SOLUTION
ibarrau
Super User
Super User

Hola, tienes un error en web.content. Debería ser así:

Web.Contents("https://monitoringapi.solaredge.com",
[
    RelativePath="site/123456/energy",
    Query= [
        startDate=Date.ToText(MyStartDate, "yyyy-mm-dd"),
        endDate=Date.ToText(MyEndDate, "yyyy-mm-dd"),
        timeUnit=MyTimeUnit,
        api_key=MyAPIKey
    ]
]
)

Puedes comprobar sintaxis aquí en caso de que tenga algo mal: https://blog.crossjoin.co.uk/2016/08/16/using-the-relativepath-and-query-options-with-web-contents-i...

Espero que eso ayude,


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

View solution in original post

4 REPLIES 4
ibarrau
Super User
Super User

Hola, tienes un error en web.content. Debería ser así:

Web.Contents("https://monitoringapi.solaredge.com",
[
    RelativePath="site/123456/energy",
    Query= [
        startDate=Date.ToText(MyStartDate, "yyyy-mm-dd"),
        endDate=Date.ToText(MyEndDate, "yyyy-mm-dd"),
        timeUnit=MyTimeUnit,
        api_key=MyAPIKey
    ]
]
)

Puedes comprobar sintaxis aquí en caso de que tenga algo mal: https://blog.crossjoin.co.uk/2016/08/16/using-the-relativepath-and-query-options-with-web-contents-i...

Espero que eso ayude,


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

Gracias 🙂

Ahora me estoy moviendo un poco más

amitchandak
Super User
Super User

@d215aquitania , de alguna manera, no soy capaz de localizar el error en el texto. ¿Puede resaltar el error

Gracias por buscar. Esto es todo lo que estoy recibiendo por medio de un error:

Expression.Error: se pasaron 3 argumentos a una función que espera entre 1 y 2.
Detalles:
Patrón
Argumentos[Lista]

No puedo fijarlo más cerca que eso. Si invoco la función directamente e insumo los valores relevantes, sigo obteniendo los mismos.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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