Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hai All,
Question: Need solution in both M-QUERY and DAX to get the previous row value into a new column.
The below table represents a sample data representing the price for the corresponding Dates.
Pcd-Price for current date
ppdr-Price for previous date reference.
ppd-price for previous date
Here we considered the data which is from date 10 to 19(refer above table).
For Example
Solved! Go to Solution.
Hi @Anonymous
If you column [S.No] is like Index, use this column, otherwise add an index column, M here
Table.AddColumn(#"Changed Type", "ppd_M", each #"Changed Type"[pcd]{[S.No]}?)
DAX here
ppd_DAX =
VAR CurNo = 'Table'[S.No]
RETURN
CALCULATE(VALUES('Table'[pcd]),FILTER(ALL('Table'),'Table'[S.No]=CurNo+1))
Hi @Anonymous
If you column [S.No] is like Index, use this column, otherwise add an index column, M here
Table.AddColumn(#"Changed Type", "ppd_M", each #"Changed Type"[pcd]{[S.No]}?)
DAX here
ppd_DAX =
VAR CurNo = 'Table'[S.No]
RETURN
CALCULATE(VALUES('Table'[pcd]),FILTER(ALL('Table'),'Table'[S.No]=CurNo+1))
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 19 | |
| 9 | |
| 8 | |
| 7 | |
| 6 |