Forum Discussion
Edgar_massa
2 years agoHelper II
balance calculation
Good night guys Here's the thing, I have a bank balance table that brings me the balance on the 1st of each month, and I have a fact table containing my realized balance (income - expense). I need ...
- 2 years ago
Good afternoon
I managed to solve it as follows
VAR Saldo1 = [Saldo Realizado] + [Saldo de Contas]VAR Calc =CALCULATE([Saldo Realizado] + [Saldo de Contas],FILTER(ALLSELECTED(dim_Calendario),[Saldo Realizado] + Saldo1 ),dim_Calendario[Data] <= MAX(dim_Calendario[Data]))Very similar to your solution danextianVery Thanks
danextian
2 years agoSuper User
Hi Edgar_massa ,
If i undestand your use case right, you're getting the running balance of Saldo Realizado and add it to Saldo Bancario. Try these measures:
=
CALCULATE (
[Saldo Realizado],
FILTER ( ALL ( datestable ), datestable[date] <= MAX ( datestable[date] ) )
) + [Saldo Bancario]
=
CALCULATE (
[Saldo Realizado],
FILTER (
ALLEXCEPT ( datestable, datestable[month] ),
datestable[date] <= MAX ( datestable[date] )
)
) + [Saldo Bancario]
=
CALCULATE ( [Saldo Realizado], DATESMTD ( datestable[month] ) ) + [Saldo Bancario]
If Saldo Realizado and Saldo Bancario are not measures, replace them with something like SUM( table[Saldo Realizado ] ) and SUM( table[Saldo Bancario] ).