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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Previous row value

Hi there,

I need to get previous row value (OFFER_TYPE) and need help. I tried DAX but its only giving me partial result.
The resulted values should be previous rows taken from column "OFFER_TYPE", as marked in blue in column "previous value".

 

INDEXPOD_PDR CODEDATEOFFER_TYPEPREEVIOUS VALUE

1

16666

01/01/21NEG 
21666601/02/21NEGNEG
31666601/03/21SEMINEGNEG
41666601/04/21SEMINEGSEMINEG
51666601/05/21SEMINEGSEMINEG

 

My DAX formula:

_getResult =
var _currentIndex=MAX(cb_attiva[INDEX])
var off_ = cb_attiva[OFFER_TYPE]
var final = CALCULATE( off_, FILTER(ALL(cb_attiva),cb_attiva[Indice]=_currentIndex-1))
return
final
 
 

I will appreciate your help.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

Please try add a new column by below dax formula:

 

Pre_Offer_type =
VAR cur_index = 'Table'[INDEX]
VAR pre_index = cur_index - 1
VAR pre_value =
    CALCULATE (
        MAX ( 'Table'[OFFER_TYPE] ),
        FILTER ( 'Table', 'Table'[INDEX] = pre_index )
    )
RETURN
    pre_value

 

 

vbinbinyumsft_0-1659076681473.png

Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Anonymous ,

 

Please try add a new column by below dax formula:

 

Pre_Offer_type =
VAR cur_index = 'Table'[INDEX]
VAR pre_index = cur_index - 1
VAR pre_value =
    CALCULATE (
        MAX ( 'Table'[OFFER_TYPE] ),
        FILTER ( 'Table', 'Table'[INDEX] = pre_index )
    )
RETURN
    pre_value

 

 

vbinbinyumsft_0-1659076681473.png

Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors