Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin 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.
@Community Members.
I need help in writing the appropriate DAX code that looks for the last payment date of each account in a dataset.
The code must group the Account ID column by Account IDs and look for the lastest date in Date of Payment column.
| Account ID | Payment Method | Date of Payment |
| 111000111 | Cash | 23/01/2023 |
| 111000111 | Cash | 24/01/2023 |
| 111000111 | Cash | 25/01/2023 |
| 111000111 | Cheque | 26/01/2023 |
| 111000111 | Credit Card | 27/01/2023 |
| 111000111 | Direct Credit | 28/01/2023 |
| 111000111 | Cash | 29/01/2023 |
Solved! Go to Solution.
hi @EMUDATA
then try to add a calculated column like:
column =
VAR _lastdate=
MAXX(
FILTER(
data,
data[Account ID]=EARLIER(data[Account ID])
),
data[Date of Payment]
)
RETURN
IF(
[Date of Payment]=_lastdate,
1,0
)it worked like:
Hey Dear,
You can try this code!
@FreemanZ something life IF(lastdate),1,0. But I am missing how to do this for each account id
hi @EMUDATA
then try to add a calculated column like:
column =
VAR _lastdate=
MAXX(
FILTER(
data,
data[Account ID]=EARLIER(data[Account ID])
),
data[Date of Payment]
)
RETURN
IF(
[Date of Payment]=_lastdate,
1,0
)it worked like:
@FreemanZ thank you but I need to create a conditional column that indicates the last payment so I can filter data on last payment record for each account.
hi @EMUDATA
try to plot any visual with Account ID column and a measure like:
Measure = MAX(TableName[Date of Payment])
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 3 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 11 | |
| 9 | |
| 8 | |
| 6 | |
| 6 |