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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
mmar
Regular Visitor

Filtrar Dinamically DirectQuery

Hola

Tengo dos tablas, Premix_Batch e historiador, y ambas son DirectQueries de una base de datos SQL. Filtrado manual (dentro de PBI) el orderNumber para Premix_Batch obtengo una fila, entre sus columnas hay StartTime y EndTime.

Para obtener datos para Historian utilizo un procedimiento almacenado que acepta como entrada un StartTime y un EndTime (algo como: SELECT * FROM myHistorianTable WHERE LogDateTime BETWEEN StartTime2 And EndTime2). En este momento utilizo valores de solicitud para StartTime2 y EndTime2 (por ejemplo: ENTRE '2020-03-22' Y '2020-03-24').

Por razones de tamaño de datos, debo filtrar los datos entrantes de myHistorianTable en DirectQuery y no puedo importarlos.

Me gustaría poder seleccionar todas las filas en El historiador donde el valor de columna LogDateTime está entre los valores Start_Time y End_Time de la tabla Premix_Batch.

He intentado usar Parameters dentro de DirectQuery pero no puedo modificar el parámetro dinámicamente.

Por ejemplo: "SELECT * FROM myHistorianTable WHERE LogDateTime BETWEEN "Parameter1" And "Parameter2"".

También he intentado usar una consulta (que apunta al primer valor de la columna StartTime1 de la tabla Premix_Batch) dentro de DirectQuery, pero obtengo el error: "Formula.Firewall: Query 'QueryName' (paso 'StepName') hace referencia a otras consultas o pasos y, por lo tanto, puede que no acceda directamente a un origen de datos. Por favor, reconstruya esta combinación de datos."

Debajo de DirectQuery utilizo:

Dejar
Fuente: Sql.Database("VHISTORIAN2017", "Tiempo de ejecución", [Consulta"SELECT * De (-(lf)SELECT * (lf) FROM History (lf)

WHERE History.TagName IN ('SysPerfConfigCPU')-(lf) And wwRetrievalMode ? 'Cyclic'(lf)

And wwCycleCount á 100o(lf) Y wwQualityRule á 'Extendido'(lf)

Y wwVersion á 'Latest'(lf)

Y DateTime > '"& Text.From(StartDate) &"' ?(lf)

Y DateTime <' '"& Text.From(EndDate) &"' ) temp-(lf)LEFT JOIN AnalogTag ON AnalogTag.TagName ?temp. NombreDeEtiqueta(lf)LEFT JOIN EngineeringUnit ON AnalogTag.EUKey á EngineeringUnit.EUKey-(lf)LEFT JOIN QualityMap ON QualityMap.QualityDetail - temp. QualityDetail (lf)

DONDE temp. StartDateTime > '"& Text.From(StartDate) &"' "])
En
Fuente

Tabla Premix_Batch:

Screenshot (307)_LI.jpg

Mesa de Historiador:

Screenshot (308)_LI.jpg

2 REPLIES 2
amitchandak
Super User
Super User

Hola

Usé desde el principio el artículo de la puerta roja como referencia para usar el parámetro. Pero entonces no puedo cambiar dinámicamente el parámetro que lo establece igual a algunos valores de la tabla Premix_Batch.

¿Hay otra manera o un workaraound para lograr mi objetivo?

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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

Top Kudoed Authors