March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hola-
Tengo los siguientes datos en la vista Tabla y necesito una fórmula de Dax para calcular una columna con el total basado en el número calculado de la semana anterior (factor * total anterior) para cada categoría:
Tabla: DATOS
Categoría | Fecha | factor | Total | cálculo |
A | 01/01/24 | - | 100 | |
A | 01/08/24 | 1.01682 | 101.68 | (100*1.01682) |
A | 01/15/24 | 1.01734 | 103.45 | (101.68*1.01734) |
A | 01/22/24 | 1.01939 | 105.45 | (103.45*1.01939) |
A | 01/29/24 | 1.01854 | 107.41 | (105.45*1.01854) |
B | 01/01/24 | 1.01792 | 50 | |
B | 01/08/24 | 1.01612 | 50.81 | |
B | 01/15/24 | 1.01332 | 51.48 | |
B | 01/22/24 | 1.01134 | 52.07 | |
B | 01/29/24 | 1.01166 | 52.67 |
El código que he probado y fallado (NaN) es el siguiente:
CALCULATION =
VAR _MINVALUE =
DATA[Total]
*CALCULATE(
SUM(DATA[factor]),
FILTER(DATA,DATA[Date]=MIN('DATA'[Date]])&&DATA[Category]=DATA[Category])
)
RETURN
IF(
DATA[Date]=MIN('DATA'[Date]])&&DATA[Category]=DATA[Category],
_MINVALUE,
CALCULATE(
PRODUCT(DATA[factor]),
FILTER(DATA,DATA[Date]<=EARLIER(DATA[Date])&&DATA[Category]=DATA[Category])
)*DATA[factor]
)
Gracias de antemano.
Solved! Go to Solution.
¡Respondió!
Column = VAR TempTable = FILTER('Table','Table'[Category]=EARLIER('Table'[Category]) && 'Table'[Date]<=EARLIER('Table'[Date])) VAR FirstVal = MAXX(TOPN(1,TempTable,'Table'[Date],1),'Table'[Total]) RETURN PRODUCTX( TempTable, VAR MinDateOfCat = MINX(TempTable,'Table'[Date]) RETURN IF('Table'[Date]=MinDateOfCat,1,'Table'[factor]) )*FirstVal
¡Respondió!
Column = VAR TempTable = FILTER('Table','Table'[Category]=EARLIER('Table'[Category]) && 'Table'[Date]<=EARLIER('Table'[Date])) VAR FirstVal = MAXX(TOPN(1,TempTable,'Table'[Date],1),'Table'[Total]) RETURN PRODUCTX( TempTable, VAR MinDateOfCat = MINX(TempTable,'Table'[Date]) RETURN IF('Table'[Date]=MinDateOfCat,1,'Table'[factor]) )*FirstVal
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.