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
Hi
I have the below data, and i need a custom column to calculate the previous days value based on the "product" and "NewOrExistingMember" filter. There are multiple Products and also multiple "NewOrExistingMember" selections
Any help would be much appreciated!
🙂
Solved! Go to Solution.
In DAX you can’t reference the previous row in any way because there is no order to the rows, So fi you need to get previous row, you can create a rank column, and then use LOOKUPVALUE function to get it.
Sample data and DAX for you reference.
Rank =
RANKX (
FILTER (
Table1,
Table1[Group] = EARLIER ( Table1[Group] )
&& Table1[Group2] = EARLIER ( Table1[Group2] )
),
Table1[Amount],
,
ASC
)
PreviousValue =
LOOKUPVALUE (
Table1[Amount],
Table1[Group], Table1[Group],
Table1[Group2], Table1[Group2],
Table1[Rank], Table1[Rank] - 1
)
Regards,
Charlie Liao
In DAX you can’t reference the previous row in any way because there is no order to the rows, So fi you need to get previous row, you can create a rank column, and then use LOOKUPVALUE function to get it.
Sample data and DAX for you reference.
Rank =
RANKX (
FILTER (
Table1,
Table1[Group] = EARLIER ( Table1[Group] )
&& Table1[Group2] = EARLIER ( Table1[Group2] )
),
Table1[Amount],
,
ASC
)
PreviousValue =
LOOKUPVALUE (
Table1[Amount],
Table1[Group], Table1[Group],
Table1[Group2], Table1[Group2],
Table1[Rank], Table1[Rank] - 1
)
Regards,
Charlie Liao
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 36 | |
| 33 | |
| 31 | |
| 28 |
| User | Count |
|---|---|
| 129 | |
| 88 | |
| 79 | |
| 68 | |
| 63 |