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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
roalexan
Employee
Employee

Cómo utilizar el valor de segmentación de datos seleccionado como parámetro de consulta en la llamada web

Estoy un poco bloqueado tratando de averiguar cómo hacer una llamada de servicio web utilizando lo que el usuario seleccionó en una segmentación de datos como el valor de un parámetro de consulta. Como ejemplo simplificado, supongamos que mi servicio web toma un único identificador de producto JSON (pid) y devuelve un único valor JSON (price), lo transforma en una tabla y lo muestra en la interfaz de usuario. Puedo crear una consulta que lo haga:

let
selected_pid_value = "a",
url = "<myurl>",
body = Json.FromValue([pid = selected_pid_value]),
Source = Json.Document(Web.Contents(url,[Headers = [#"Content-Type"="application/json"], Content = body ] )),
#"Converted to Table" = Record.ToTable(Source)
in
#"Converted to Table"

y esto funcionará porque codifiqué de forma rígida el valor de selected_pid_value. Ahora diga mosqueo que creo una nueva tabla llamada "pid" usando lo siguiente:

click: Enter Data
enter: a, b, c
type: Name: pid
click: Load

Cree una segmentación de datos para ella y, por último, cree una medida para ella mediante:

pid_value = SELECTEDVALUE(pid[Value])

Entonces, en lugar de codificar de forma rígida el valor de selected_pid_value anteriores, utilizo:

selected_pid_val = [pid_value],

Esto me da el siguiente error:

Expression.Error: Hay un identificador desconocido. ¿Usó la abreviatura [campo] para un _[field] fuera de una expresión 'each'?

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@roalexan

Puede echar un vistazo a la publicación a continuación.

https://community.powerbi.com/t5/Desktop/How-do-I-Call-a-Power-Query-M-Function-from-a-DAX-Measure/m...

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Syndicate_Admin
Administrator
Administrator

@roalexan ,

¿Pudo pasar el valor seleccionado de la segmentación de datos a la llamada a la API?

Atascado con el mismo problema.

Cualquier ayuda sería apreciada

Gracias

v-chuncz-msft
Community Support
Community Support

@roalexan

Puede echar un vistazo a la publicación a continuación.

https://community.powerbi.com/t5/Desktop/How-do-I-Call-a-Power-Query-M-Function-from-a-DAX-Measure/m...

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
Super User
Super User

Hoy no puedes hacer eso...

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.