Forum Discussion
Compound Fees
Hi Brenoo
The table you'd want to iterate in your PRODUCTX is the YEAR and MONTH columns included in the visual.
The ALLSELECTED function gives you the filters applied to the visual as a whole.
So, something like the below, that uses a Date table with Year, Month and YearMonth columns:
REND TOTAL % =
VAR _YearMonths =
FILTER(
ALLSELECTED('Date'[Year],'Date'[Month], 'Date'[YearMonth]),
'Date'[YearMonth] <= MAX('Date'[YearMonth])
)
VAR _Result =
PRODUCTX(
_YearMonths,
[REND%]
)
RETURN
_Result
Hello, first of all, thanks for your help. I forgot to let you know that Date Year and Date Month are colums from a Calendar Table that is related to a colum "DATE" type on the table INVEST. Tried to addapted your code to:
Rend_Total % = VAR _YearMonths =
FILTER(
ALLSELECTED(CALENDARIO[Date].[Date]),
CALENDARIO[Date].[Date] <= MAX('INVEST MOV'[DATA])
)
VAR _Result =
PRODUCTX(_YearMonths, [Rend %])
RETURN
_Result
It did not work.
here are all my code related to [Rend%]
Rend % = CALCULATE(
DIVIDE([Rend], Medidas[Saldo_Rend], 0),
'INVEST MOV'[DATA]
)
Saldo_Rend = CALCULATE(
Medidas[Saldo]-[Rend],
'INVEST MOV'[DATA]
)
Rend = CALCULATE(
Medidas[Saldo]-Medidas[Aplic]-Medidas[Aporte]-Medidas[Resgate]-Medidas[Liquidado]-Medidas[Saldo_Ant],
'INVEST MOV'[DATA]
)
Saldo = CALCULATE(
SUM('INVEST MOV'[VALOR]),
MOVTIPO[Movtipo.Nome]="SALDO"
)
For the rest of measueres Aplic, Aporte, Resgate, Liquidado, Saldo_Ant is the same as above just changing the filter MOVTIPO[Movtipo.Nome]="SALDO" to each.