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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Previous value from one calculated column

Hi!

I want to create column in power query. It is count of previous value from new column / Rate . In first cell we need to strart with 1 as previous value and then continue with privious values. 

Is there some way to create this column in power query .

Def= if [Index]=1 then 1/[Rate] else List.Range(Source[Def],[Index]-1,1)/[Rate]

LuciaS_2-1680683255803.png

 

 

Thank you !

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@AlienSx  Thanks for your solutions maybe I am doing someting wrong but there is still Expression.Error: A circular reference was encountered during evaluation. But  this works for me :

= List.Transform(List.Skip(List.Accumulate(#"Zmenený typ1"[Rate], {1}, (s,c)=> s & {List.Last(s)/c})), Number.From)

 

but thanks i appreciate it

View solution in original post

9 REPLIES 9
Anonymous
Not applicable

@AlienSx Only first cell is Ok others are with  Error 

LuciaS_0-1680685905540.png

Translation :

Expression.Error: Def table column not found.
Details:
Def

Formula can't find [Def] column in Source table. You either don't have a table named Source or colum named Def in there. Do you still have Zdroj table? Use it instead of Source in the code. 

Anonymous
Not applicable

@AlienSx Translation of Source is Zdroj in my language . I thaought that is ok to put there only "Source".  I repleace Source with name of table and there is anothr error 

LuciaS_0-1680686760160.png

Expression.Error: A circular reference was encountered during evaluation.

@Anonymous what you are trying to do is recursive calculations. So you should be using something like this (via List.Accumulate)

= Table.AddColumn(Source, "DEF", (w) => List.Accumulate(List.FirstN(Source[Rate], w[Index]), 1, (s,c) => s/c))

 or write a recursive function and call it to create DEF column

    f_recursive = (x, rates, i, max_i) =>
        let 
            a = x / rates{i}
        in if i = max_i then a else @f_recursive(a, rates, i+1, max_i),
    DEF = Table.AddColumn(Source, "DEF", (w) => f_recursive(1, Source[Rate], 0, w[Index] - 1))
Anonymous
Not applicable

@AlienSx  Thanks for your solutions maybe I am doing someting wrong but there is still Expression.Error: A circular reference was encountered during evaluation. But  this works for me :

= List.Transform(List.Skip(List.Accumulate(#"Zmenený typ1"[Rate], {1}, (s,c)=> s & {List.Last(s)/c})), Number.From)

 

but thanks i appreciate it

I completely overlooked that you are trying to create [Def] column with this code 😂 It's not going to work. Give me some time. Taking your numbers into consideration overflow comes sooner than later. 

 

Anonymous
Not applicable

@AlienSx Hello, there is still Error becaouse of Def column which I am creating . Is tehre some way to sole it ? 

LuciaS_0-1680685539953.png

 

what kind of error? Select a cell with error and get back with PQ error message

AlienSx
Super User
Super User

Hello, @Anonymous List.Range returns you a list, not a single value. Providing that your index column starts with 1, try this instead

Def = if [Index]= 1 then 1/[Rate] else Source[Def]{[Index] - 2}/[Rate]

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.