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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
Syndicate_Admin
Administrator
Administrator

SQL a DAX

¡Hola a todos! ¿Cómo se convierte este querry en DAX?

Quiero estandarizar queuries y esperaba que fuera posible tener este como una medida / tabla (s).

CON cte_elevation AS (

seleccionar well_id, SUM(datum_elevation) * -0.3048 AS elevación

de CD_DATUM

donde is_default 'Y'

grupo por well_id

)

,cte_plan AS (

SELECT wp.well_id, 'Plan' como Tipo, (wp.md_to * -0.3048) + elevación COMO Profundidad

,cast(sum(isnull(wp.target_duration,0)) over (partición por orden wp.well_id por cast(step_no as smallint)) como horas

,cast(step_no como int) AS OrderBy

DE dbo. DM_WELL_PLAN_OP wp

UNIRSE a cte_elevation e ON wp.well_id e.well_id

DONDE target_duration no es nula

Y md_to no es nula

)

,cte_actual AS (

SELECT d.well_id, Tipo AS 'Real', (d.md_current * -0.3048) + e.elevation AS Depth

,isnull(days_on_location,0) * 24 como horas

,CAST(date_report como int) AS OrderBy

DE dbo. DM_DAILY d

UNIRSE a cte_elevation e ON d.well_id e.well_id

)

SELECCIONAR * DE cte_plan

UNION ALL

SELECCIONAR * DE cte_actual

1 REPLY 1
Syndicate_Admin
Administrator
Administrator

@Alex_0201 , Ver si este blog puede ayudarle a construir este

https://www.sqlbi.com/articles/from-sql-to-dax-joining-tables/

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.