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.
Hola
Acumule los valores respetando dos condiciones:
Solved! Go to Solution.
@Vilmar ,
Intente usar esta medida:
_Esperado =
VAR _currentDate = MAX ('Table'[Data])
VAR _currentValue = MIN ('Table'[Valor])
VAR _minDate = MINX('Table', 'Table'[Data])
VAR _lastNegative = CALCULATE(MAX('Table'[Data]), FILTER(ALL('Table'), 'Table'[Data] < _currentDate && 'Table'[Valor] < 0))
VAR _lastPositive = CALCULATE(MAX('Table'[Data]), FILTER(ALL('Table'), 'Table'[Data] < _currentDate && 'Table'[Valor] >= 0))
VAR _tbConsecutiveDate =
FILTER(
SUMMARIZE(
FILTER(ALL('Table'), 'Table'[Data] <= _currentDate),
'Table'[Data],
"NextDate", DATEDIFF('Table'[Data], CALCULATE(MIN('Table'[Data]), FILTER(ALL('Table'), 'Table'[Data] > EARLIER('Table'[Data]))), DAY)
),
[NextDate] = 1 || 'Table'[Data] = _currentDate
)
VAR _positivesValues =
CALCULATE (
SUMX ( FILTER ( 'Table', 'Table'[Valor] >= 0 ), 'Table'[Valor] ),
FILTER ( ALL ( 'Table'[Data] ), 'Table'[Data] > _lastNegative && 'Table'[Data] <= _currentDate), _tbConsecutiveDate
)
VAR _negativeValues =
CALCULATE (
SUMX ( FILTER ( 'Table', 'Table'[Valor] < 0 ), 'Table'[Valor] ),
FILTER ( ALL ( 'Table'[Data] ), 'Table'[Data] > _lastPositive && 'Table'[Data] <= _currentDate), _tbConsecutiveDate
)
RETURN
IF ( _currentValue < 0, _negativeValues, _positivesValues )
@Vilmar ,
Intente usar esta medida:
_Esperado =
VAR _currentDate = MAX ('Table'[Data])
VAR _currentValue = MIN ('Table'[Valor])
VAR _minDate = MINX('Table', 'Table'[Data])
VAR _lastNegative = CALCULATE(MAX('Table'[Data]), FILTER(ALL('Table'), 'Table'[Data] < _currentDate && 'Table'[Valor] < 0))
VAR _lastPositive = CALCULATE(MAX('Table'[Data]), FILTER(ALL('Table'), 'Table'[Data] < _currentDate && 'Table'[Valor] >= 0))
VAR _tbConsecutiveDate =
FILTER(
SUMMARIZE(
FILTER(ALL('Table'), 'Table'[Data] <= _currentDate),
'Table'[Data],
"NextDate", DATEDIFF('Table'[Data], CALCULATE(MIN('Table'[Data]), FILTER(ALL('Table'), 'Table'[Data] > EARLIER('Table'[Data]))), DAY)
),
[NextDate] = 1 || 'Table'[Data] = _currentDate
)
VAR _positivesValues =
CALCULATE (
SUMX ( FILTER ( 'Table', 'Table'[Valor] >= 0 ), 'Table'[Valor] ),
FILTER ( ALL ( 'Table'[Data] ), 'Table'[Data] > _lastNegative && 'Table'[Data] <= _currentDate), _tbConsecutiveDate
)
VAR _negativeValues =
CALCULATE (
SUMX ( FILTER ( 'Table', 'Table'[Valor] < 0 ), 'Table'[Valor] ),
FILTER ( ALL ( 'Table'[Data] ), 'Table'[Data] > _lastPositive && 'Table'[Data] <= _currentDate), _tbConsecutiveDate
)
RETURN
IF ( _currentValue < 0, _negativeValues, _positivesValues )
No estoy seguro de si esto es lo que quiere decir, pero pruebe estas expresiones de medida a continuación en un objeto visual de tabla con su columna Fecha. Reemplace Table por el nombre real de la tabla. Si no es así, por favor aclare más.
Esperado =
VAR thisdate =
MAX ( Table[Data] )
VAR thisvalue =
MIN ( Table[Valor] )
VAR positives =
CALCULATE (
SUMX ( FILTER ( Table, Table[Valor] >= 0 ), Table[Valor] ),
FILTER ( ALLSELECTED ( Table[Data] ), Table[Data] <= thisdate )
)
VAR negatives =
CALCULATE (
SUMX ( FILTER ( Table, Table[Valor] < 0 ), Table[Valor] ),
FILTER ( ALLSELECTED ( Table[Data] ), Table[Data] <= thisdate )
)
RETURN
IF ( thisvalue < 0, negatives, positives )
Si esto funciona para usted, márquelo como la solución. Los elogios también son apreciados. Por favor, avísame si no.
saludos
palmadita
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
@Vilmar - Puede que no parezca al principio, pero creo que necesita una variación de Cthulhu:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Cthulhu/m-p/509739#M211
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
2 | |
2 | |
2 | |
2 | |
1 |