Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
@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])
User | Count |
---|---|
57 | |
33 | |
18 | |
18 | |
15 |
User | Count |
---|---|
94 | |
85 | |
37 | |
22 | |
20 |