Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
Check it out now!Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more
Como calcular o valor do acumulado do IPCA no ano até o mês atual de forma que o acumulado do mês de janeiro é o proprio janeiro e os demais é definido pela seguinte formula no excel: =(1+IPCA_NO_MÊS/100)*IPCA_NO_MÊS_ANTERIOR)+IPCA_NO_MÊS
Tabela IPCA mês a mês - 2018 | ||
IPCA | Valor (%) | Acumulado do ano (%) |
jan/18 | 0,29 | 0,29 |
fev/18 | 0,32 | 0,61 |
mar/18 | 0,09 | 0,70 |
abr/18 | 0,22 | 0,92 |
mai/18 | 0,4 | 1,33 |
jun/18 | 1,26 | 2,60 |
jul/18 | 0,33 | 2,94 |
ago/18 | -0,09 | 2,85 |
set/18 | 0,48 | 3,34 |
out/18 | 0,45 | 3,81 |
nov/18 | -0,21 | 3,59 |
dez/18 | 0,15 | 3,75 |
Fiz essa solução em Power Query:
let _index = [Index] in
List.Accumulate(Table.SelectRows(#"Added Index", each [Index] <= _index)[#"Valor (%)"],
0, (s,c) =>
(1 + c / 100) * s + c
)
esse é o mcode:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("RczLDkAwEIXhd5l1hY5LeJbGoqKEoIlLF56eTM3YfjnnNwZmu6W6BgWZwgZaZWBwgSVHktXuLFnc2E4EeTOxFATz9YW1wuqTRcJ5zIw+SiLlw53SqUn89UtJsvkgN9REvbt5pN9R+wA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [IPCA = _t, #"Valor (%)" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"IPCA", type date}, {"Valor (%)", type number}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"IPCA", "Date"}}),
#"Added Index" = Table.AddIndexColumn(#"Renamed Columns", "Index", 0, 1),
#"Added Custom" = Table.AddColumn(#"Added Index", "Custom", each let _index = [Index] in
List.Accumulate(Table.SelectRows(#"Added Index", each [Index] <= _index)[#"Valor (%)"],
0, (s,c) =>
(1 + c / 100) * s + c
))
in
#"Added Custom"
Vou tentar fazer em DAX também.
Tenta essa medida:
No powerbi existe a coluna data que está relacionada com minha dCalendario, a minha dificudade está em fazer o calculo dos juros compostos do IPCA porque não é um simples calculo acumulado até o mês.
Formula de calculo no excel: (1+IPCA_NO_MÊS/100)*IPCA_NO_MÊS_ANTERIOR)+IPCA_NO_MÊS
No relatório é fácil, basta criar uma tabela, colocar o ANO, depois valor e pronto.
Agora por dax, também fico no aguardo.