Forum Discussion
Jorge1986
8 years agoRegular Visitor
Error in a measure using Earlier
Hi, I have a table called factVentas with lots of data, I need a dynamic report of paretto 80 20 by dates. The issue is that I have an error in making an accumulated sum within a measure. Somet...
- 8 years ago
Hi Jorge1986,
EARLIER/EARLIEST function can be used in calculated column only , but not supported within a measure.
In your scenario, please first create a calculated column in 'facyVentas':
Rank col = RANKX ( ALL ( factVentas ), CALCULATE ( SUM ( factVentas[VENTA NETA] ), ALLEXCEPT ( factVentas, factVentas[Category] ) ), , DESC, DENSE )Then, create a measure to return accumulated sum:
$VentasAcumuladas = CALCULATE ( SUM ( factVentas[VENTA NETA] ), FILTER ( ALL ( factVentas ), factVentas[Rank col] <= MAX ( factVentas[Rank col] ) ) )Best regards,
Yuliana Gu
- 8 years agoDear v-yulgu-msft, His contribution was vital to reach the solution, for my case I had to make small modifications and in that way make him work dynamically. Thank you very much, enormous support, enormous brain ... Greetings from Ecuador.
v-yulgu-msft
8 years agoMicrosoft Employee
Hi Jorge1986,
EARLIER/EARLIEST function can be used in calculated column only , but not supported within a measure.
In your scenario, please first create a calculated column in 'facyVentas':
Rank col =
RANKX (
ALL ( factVentas ),
CALCULATE (
SUM ( factVentas[VENTA NETA] ),
ALLEXCEPT ( factVentas, factVentas[Category] )
),
,
DESC,
DENSE
)
Then, create a measure to return accumulated sum:
$VentasAcumuladas =
CALCULATE (
SUM ( factVentas[VENTA NETA] ),
FILTER (
ALL ( factVentas ),
factVentas[Rank col] <= MAX ( factVentas[Rank col] )
)
)
Best regards,
Yuliana Gu
Jorge1986
8 years agoRegular Visitor
Dear v-yulgu-msft, His contribution was vital to reach the solution, for my case I had to make small modifications and in that way make him work dynamically. Thank you very much, enormous support, enormous brain ... Greetings from Ecuador.