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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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