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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Syndicate_Admin
Administrator
Administrator

Medida acumulada utilizando la relación ANTES e inactiva

Estimados colegas,

Estoy tratando de hacer que esta medida funcione durante los últimos días, pero parece estar por encima de mi cabeza. Probé muchas cosas explianed en otros lugares sobre medidas acumuladas, pero parece que mi caso es algo especial. Creo que me acercó bastante a la solución, pero no puedo conseguirla.

Necesito una MEDIDA para calcular el total acumulado de otra medida, como en el tabel a continuación:

anmattos_1-1632142154883.png

Mi fórmula actual para la medida "Total Acumulado" es:

=
CALCULAR (
MAXX (
fDCA;
COUNTROWS ( FILTER ( fDCAs; fDCAs[Rev] <= EARLY ( fDCAs[Rev] ) ) )
);
USERELATIONSHIP ( dCalendar[Date]; fDCAs[Data Aprovação DCA] )
)

NOTA 1: Necesito una MEDIDA, y no una COLUMNA CALCULADA. Esto agrega un poco de complejidad al usar EARLIER, ya que necesita un contexto de fila anterior.

NOTA 2: La tabla tiene filtros en el campo FILTER y segmentaciones de datos con DATES.
NOTA 3: Para la medida de APROBACIÓN TOTAL tengo que utilizar una relación inactiva entre la tabla CALENDAR y la tabla de datos.

NOTA 4: En realidad estoy usando PowerPivot.

El archivo XLSX está disponible en el siguiente enlace.

https://www.dropbox.com/scl/fi/tr2wuflc63jasjzw26kof/Accumulated-Calculation.xlsx?dl=0&rlkey=zj9g961...

Muchas gracias por la ayuda,

1 ACCEPTED SOLUTION

@anmattos Olvidé el TODO

Total Approval =
  VAR __Rev = MAX('fDCA'[Rev])
  VAR __Table = 
    ADDCOLUMNS(
      DISTINCT(ALL('fDCA'[Rev])),
      "__TotalApprovals",[Total Approvals]
    )
RETURN
  SUMX(FILTER(__Table,[Rev]<=__Rev),[__TotalApprovals])

View solution in original post

5 REPLIES 5
Syndicate_Admin
Administrator
Administrator

@anmattos Probar:

Total Approval =
  VAR __Rev = MAX('fDCA'[Rev])
  VAR __Table = 
    ADDCOLUMNS(
      DISTINCT('fDCA'[Rev]),
      "__TotalApprovals",[Total Approvals]
    )
RETURN
  SUMX(FILTER(__Table,[Rev]<=__Rev),[__TotalApprovals])

Hola @Greg_Deckler ,

Muchas gracias por la solución propuesta. Desafortunadamente devolvió los mismos resultados que mi fórmula actual.

Saludos

@anmattos Olvidé el TODO

Total Approval =
  VAR __Rev = MAX('fDCA'[Rev])
  VAR __Table = 
    ADDCOLUMNS(
      DISTINCT(ALL('fDCA'[Rev])),
      "__TotalApprovals",[Total Approvals]
    )
RETURN
  SUMX(FILTER(__Table,[Rev]<=__Rev),[__TotalApprovals])

¡¡¡Uau!!!

¡Gracias @Greg_Deckler! ¡Funcionó! Ahora necesitaré más de 3 días para entenderlo, pero el problema está resuelto.

¡Muchas gracias por su tiempo!

@anmattos Aquí hay un recorrido:

Total Approval =
  VAR __Rev = MAX('fDCA'[Rev]) // Get the current value of Rev column in the current row
  VAR __Table = 
    ADDCOLUMNS(
      DISTINCT('fDCA'[Rev]), // Since we are in a visual where there is a single value of Rev in context, override this and get all the values of the distinct values of Rev in a single column table.
      "__TotalApprovals",[Total Approvals] // Add the measure to this single column table and the values returned are for the individual Rev values in the current virtual table row.
    )
RETURN
  SUMX(FILTER(__Table,[Rev]<=__Rev),[__TotalApprovals]) // SUM up the measure in our virtual table but filter the table such that only "previous" rows are summed.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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