cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Evolución de un valor por tiempo (+ uso del valor más reciente si el nuevo valor es desconocido)

Tengo una tabla con 2 columnas: número de semana ? valor y quiero mostrar un gráfico de líneas con la evolución del valor x tiempo.


Durante algunas semanas, no tengo un valor, así que me gustaría usar el valor de la semana anterior.

¿Cómo puedo hacer esto?





1 ACCEPTED SOLUTION
Super User IV
Super User IV

@pauldesart Bueno, podrías crear una medida como esta:

Measure =
  VAR __Week = MAX([Week])
  VAR __Value = SUM([Value]) 
RETURN
  IF(
    NOT(ISBLANK(__Value)),
    __Value,
    SUMX(FILTER(ALL('Table'),[Week] = __Week - 1),[Value])
  )


---------------------------------------

@ me in replies or I'll lose your thread!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

1 REPLY 1
Super User IV
Super User IV

@pauldesart Bueno, podrías crear una medida como esta:

Measure =
  VAR __Week = MAX([Week])
  VAR __Value = SUM([Value]) 
RETURN
  IF(
    NOT(ISBLANK(__Value)),
    __Value,
    SUMX(FILTER(ALL('Table'),[Week] = __Week - 1),[Value])
  )


---------------------------------------

@ me in replies or I'll lose your thread!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

Helpful resources

Announcements
secondImage

Congratulations!

We are excited to announce the Power BI Super Users!

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.