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.
I'm currently developing a cash flow matrix and failed while trying to merge two measures in one (running totals and sum):
My idea was to add boolean indicators (Calculado Column) as such:
So that my measure could do the following:
Subtotal =
var Calculado = SELECTEDVALUE('Categorias'[Calculado])
var Runningtotal= [Running total]
Return
SWITCH(
True(),
Calculado = 0, [Total],
Calculado = 1, Runningtotal,
BLANK()
)
The referenced measures are:
Running total =
CALCULATE(
[Total],
FILTER(
ALLSELECTED('Calendário'[Data]),
ISONORAFTER('Calendário'[Data], MAX('Calendário'[Data]), DESC)
)
)
The [Total] measure:
[Total] = SUM(Movimentacoes[nValorTitulo])
When [Running Total] is in a matrix by itself it works absolutely fine, also does [Total], however if I mix both using the [Subtotal] measure, the [Running Total] results in 0 and the sum measure [Total] works just fine.
Solved! Go to Solution.
Managed to fix it:
Had to add an Index column and edit the measure:
Subtotal =
var Calculado= SELECTEDVALUE(Categorias[Calculado])
var ordemContexto = Max('Categorias'[Índice])
var ValorSubtotalresumo =
CALCULATE([Running Total],Filter(ALLNOBLANKROW('Categorias'), 'Categorias'[Índice] >= ordemContexto))
Return
SWITCH(
True(),
Calculado = 0, [Total],
Calculado = 1, ValorSubtotalresumo,
BLANK()
)
Managed to fix it:
Had to add an Index column and edit the measure:
Subtotal =
var Calculado= SELECTEDVALUE(Categorias[Calculado])
var ordemContexto = Max('Categorias'[Índice])
var ValorSubtotalresumo =
CALCULATE([Running Total],Filter(ALLNOBLANKROW('Categorias'), 'Categorias'[Índice] >= ordemContexto))
Return
SWITCH(
True(),
Calculado = 0, [Total],
Calculado = 1, ValorSubtotalresumo,
BLANK()
)
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 |
---|---|
109 | |
96 | |
77 | |
66 | |
53 |
User | Count |
---|---|
144 | |
105 | |
102 | |
89 | |
63 |