Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
@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])
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
46 | |
28 | |
22 | |
12 | |
8 |
User | Count |
---|---|
76 | |
51 | |
44 | |
16 | |
12 |