The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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".
INDEX | POD_PDR CODE | DATE | OFFER_TYPE | PREEVIOUS VALUE |
1 | 16666 | 01/01/21 | NEG | |
2 | 16666 | 01/02/21 | NEG | NEG |
3 | 16666 | 01/03/21 | SEMINEG | NEG |
4 | 16666 | 01/04/21 | SEMINEG | SEMINEG |
5 | 16666 | 01/05/21 | SEMINEG | SEMINEG |
My DAX formula:
I will appreciate your help.
Solved! Go to Solution.
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
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.
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
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.