cancel
Showing results for
Did you mean:
Highlighted
Frequent Visitor

## New Measure based on the previous "row" value of another measure

Index is an actual column and Value is a measure (table below).

How can I get the result of the previous row in a new measure?

I want to use measure as this "Value' is a result of aggregation through a few visualization filters.

 Index (Column) Value (Measure) PrevRowValue (Measure - HOW?) 0 (146,978,613) 1 (158,041,519) (146,978,613) 2 (509,767,635) (474,083,901) 3 (1,049,965,114) (976,467,556) 4 (2,027,531,439) (1,885,604,238) 5 (3,279,221,394) (3,049,675,897) 6 (4,336,233,512) (4,032,697,166)
1 ACCEPTED SOLUTION

Accepted Solutions
Super Contributor

## Re: New Measure based on the previous "row" value of another measure

Hi @PowerBIFin,

Could you mean to get the value in previous row? If so, you could refer to below steps:

Sample data:

Create below measure:

```Previous row value = var a=CALCULATE(SUM(Table1[Index]))-1
return CALCULATE(MAX('Table1'[Value]),FILTER(ALL('Table1'),'Table1'[Index]=a))```

Result:

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 REPLIES 3
Super User

## Re: New Measure based on the previous "row" value of another measure

Hi,

Super Contributor

## Re: New Measure based on the previous "row" value of another measure

Hi @PowerBIFin,

Could you mean to get the value in previous row? If so, you could refer to below steps:

Sample data:

Create below measure:

```Previous row value = var a=CALCULATE(SUM(Table1[Index]))-1
return CALCULATE(MAX('Table1'[Value]),FILTER(ALL('Table1'),'Table1'[Index]=a))```

Result:

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Frequent Visitor

## Re: New Measure based on the previous "row" value of another measure

Your solution gave me an idea what I've been doing wrong and it worked.

Wrong_Measure2 =
VAR A = [_Index]-1 // PREVIOUS ROW INDEX
RETURN
CALCULATE([Measure1],'Tbl LRA Summary'[_Index]=a)

Right_Measure2 =
VAR A = MIN([_Index])-1 // PREVIOUS ROW INDEX
RETURN
CALCULATE([Measure1],'Tbl LRA Summary'[_Index]=a)

Announcements

#### Back to School Contest

Engage and empower students with Power BI!

#### Watch Sessions On Demand!

Continue your learning in our online communities.

#### Summit Australia 2019

Travel to Melbourne and network with thousands of peers!

#### PBI Community Highlights

Check out what's new in the Power BI Community!

Top Ideas
Top Kudoed Authors
Users Online
Currently online: 42 members 904 guests
Recent signins: