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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
jgorigo
Regular Visitor

Linear interpolation DAX measure

Hola a todos. Agradezco cualquier ayuda que me proporcionen.

 

Tengo 2 tablas: uf_prosp y TBL_CCS_DAP_Test

Las 2 se relacionan con un campo fecha_proceso (31/12/2021 y 31/01/2022) y plazo_residual (número de días)

Esta medida obtiene los valores de esc_1 para el plazo_residual interpolando con los datos de las columnas _plazo y esc_1 de la tabla uf_prosp

La medida funciona correctamente. Pero siempre debe haber una sola fecha, por ejemplo 31/12/2021. Si no filtro la tabla en power query y dejo varias fechas no funciona.
¿Cómo se puede filtrar la medida por fecha?
FD_s =
VAR x3 = max(TBL_CCS_DAP_Test[p_residual])
VAR match = CALCULATE(MAX(uf_prosp[_plazo]),FILTER(uf_prosp,uf_prosp[_plazo]= x3))
VAR x1 = CALCULATE(MAX(uf_prosp[_plazo]),FILTER(uf_prosp,uf_prosp[_plazo] <= x3))
VAR x2 = CALCULATE(MIN(uf_prosp[_plazo]),FILTER(uf_prosp,uf_prosp[_plazo] >= x3))
VAR y1 = LOOKUPVALUE(uf_prosp[esc_1],uf_prosp[_plazo],x1)
VAR y2 = LOOKUPVALUE(uf_prosp[esc_1],uf_prosp[_plazo],x2)
RETURN IF(NOT(ISBLANK(match)), y1,
y1 + (x3 - x1) * (y2 - y1)/(x2 - x1)
)
 uf_prosp y TBL_CCS_DAP_Test
jgorigo_3-1659108227636.pngjgorigo_4-1659108271638.png

 

 

1 ACCEPTED SOLUTION
technolog
Super User
Super User

Hi! You can use logic like this:

VAR CurrentRow = MAX('Calendar'[WEEKINT])
VAR ProductionLW1 = CALCULATE([Value],FILTER(ALL('Calendar'), 'Calendar'[WEEKINT] = CurrentRow - 1))
VAR ProductionLW2 = CALCULATE([Value],FILTER(ALL('Calendar'), 'Calendar'[WEEKINT] = CurrentRow - 2))

View solution in original post

1 REPLY 1
technolog
Super User
Super User

Hi! You can use logic like this:

VAR CurrentRow = MAX('Calendar'[WEEKINT])
VAR ProductionLW1 = CALCULATE([Value],FILTER(ALL('Calendar'), 'Calendar'[WEEKINT] = CurrentRow - 1))
VAR ProductionLW2 = CALCULATE([Value],FILTER(ALL('Calendar'), 'Calendar'[WEEKINT] = CurrentRow - 2))

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.