cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PowerBIFin Frequent Visitor
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
v-danhe-msft Super Contributor
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:

1.PNG

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:

1.PNG

You could also download the pbix file to have a view.

 

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
Super User

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

Hi,

 

Share the link from where i can download your PBI file.

v-danhe-msft Super Contributor
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:

1.PNG

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:

1.PNG

You could also download the pbix file to have a view.

 

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.
PowerBIFin Frequent Visitor
Frequent Visitor

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

Thanks for your help!

 

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

 

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)

Helpful resources

Announcements
GregDeckler

How to Get Your Question Answered Quickly

Power BI Super User, Greg Deckler, explains

Summit North America

Power Platform Summit North America

Register by September 5 to save $200

Back to School Contest

Back to School Contest

Engage and empower students with Power BI!

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Top Ideas
Users Online
Currently online: 230 members 3,112 guests
Please welcome our newest community members: