Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Inflation index calculation - easy in excel but difficult in DAX

YearInflationInflation Index
20240.031
20230.020.970874
20220.010.951837
20210.010.942413
20200.020.933082
20190.020.914786

 

simple table, this year index is always 1

year 2023 is calculated as (2024 index / (1 + 2024 inflation)

year 2023 is calculated as (2023 index / (1 + 2023 iflation) 

 

very easy in excel but cannot do it in PBI as the measure references to itself

 

can you please help ❤️

 

index.png

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

 

Better do this in Power Query.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMlHSUTLQMzBWitUB840hfCMY3wjCN4TxDdH4BqjqDS3h/FgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Year = _t, Inflation = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Inflation", Percentage.Type}}),
    #"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 0, 1, Int64.Type),
    #"Added Custom" = Table.AddColumn(#"Added Index", "Inflation Index", each List.Accumulate({0..[Index]},1,(state,current)=>if current=0 then state else state/(1+#"Added Index"{current-1}[Inflation])), Percentage.Type)
in
    #"Added Custom"

 

How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done". Once you examined the code, replace the Source step with your own source.

 

But if you want DAX as a calculated column:

lbendlin_1-1727474939330.png

 

 

 

 

 

View solution in original post

1 REPLY 1
lbendlin
Super User
Super User

 

Better do this in Power Query.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMlHSUTLQMzBWitUB840hfCMY3wjCN4TxDdH4BqjqDS3h/FgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Year = _t, Inflation = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Inflation", Percentage.Type}}),
    #"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 0, 1, Int64.Type),
    #"Added Custom" = Table.AddColumn(#"Added Index", "Inflation Index", each List.Accumulate({0..[Index]},1,(state,current)=>if current=0 then state else state/(1+#"Added Index"{current-1}[Inflation])), Percentage.Type)
in
    #"Added Custom"

 

How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done". Once you examined the code, replace the Source step with your own source.

 

But if you want DAX as a calculated column:

lbendlin_1-1727474939330.png

 

 

 

 

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.